| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 46 | public function match($source, TokenFactoryInterface $factory) |
||
| 47 | { |
||
| 48 | preg_match_all($this->regex, $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); |
||
| 49 | |||
| 50 | $callable = $this->callable; |
||
| 51 | foreach ($matches as $match) { |
||
|
1 ignored issue
–
show
|
|||
| 52 | foreach($callable($match, $factory) as $token) { |
||
| 53 | yield $token; |
||
| 54 | } |
||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.