| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function reduce(RuleInterface $rule): \Generator |
||
| 37 | { |
||
| 38 | /** @var string $name */ |
||
| 39 | $name = yield $rule->first('Type'); |
||
| 40 | |||
| 41 | $keyValue = []; |
||
| 42 | |||
| 43 | foreach ($rule->first('GenericArguments') as $argument) { |
||
|
|
|||
| 44 | $keyValue[] = yield $argument; |
||
| 45 | } |
||
| 46 | |||
| 47 | return new GenericTypeHint($name, ...$keyValue); |
||
| 48 | } |
||
| 49 | } |
||
| 50 |
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.