Conditions | 3 |
Paths | 3 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
46 | 2 | public function match($source, TokenFactoryInterface $factory) |
|
47 | { |
||
48 | 2 | preg_match_all($this->regex, $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); |
|
49 | |||
50 | 2 | $callable = $this->callable; |
|
51 | 2 | foreach ($matches as $match) { |
|
1 ignored issue
–
show
|
|||
52 | 2 | foreach($callable($match, $factory) as $token) { |
|
53 | 1 | yield $token; |
|
54 | 2 | } |
|
55 | 2 | } |
|
56 | 2 | } |
|
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.