Total Complexity | 13 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
21 | final class FlattenNodes implements VisitorInterface |
||
22 | { |
||
23 | 14 | public function enterNode(mixed $node, VisitorContext $ctx): mixed |
|
24 | { |
||
25 | 14 | if (!$node instanceof Tag) { |
|
26 | 14 | return null; |
|
27 | } |
||
28 | |||
29 | 5 | $flatten = []; |
|
30 | 5 | foreach ($node->nodes as $child) { |
|
31 | 5 | if ($child instanceof Block || $child instanceof Template || $child instanceof Aggregate) { |
|
32 | 1 | foreach ($child->nodes as $childNode) { |
|
33 | 1 | $flatten[] = $childNode; |
|
34 | } |
||
35 | 1 | continue; |
|
36 | } |
||
37 | |||
38 | 5 | $flatten[] = $child; |
|
39 | } |
||
40 | |||
41 | 5 | $node->nodes = $this->mergeRaw($flatten); |
|
|
|||
42 | |||
43 | 5 | return null; |
|
44 | } |
||
45 | |||
46 | 14 | public function leaveNode(mixed $node, VisitorContext $ctx): mixed |
|
47 | { |
||
48 | 14 | return null; |
|
49 | } |
||
50 | |||
51 | 5 | private function mergeRaw(array $nodes): array |
|
68 | } |
||
69 | } |
||
70 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..