1 | <?php |
||
8 | class FileParser |
||
9 | { |
||
10 | protected $sourceCode = ''; |
||
11 | protected $classes = []; |
||
12 | protected $functions = []; |
||
13 | |||
14 | public function __construct($sourceCode) |
||
20 | |||
21 | /** |
||
22 | * @return CodeLimits[] |
||
23 | */ |
||
24 | public function getClassLimits() |
||
28 | |||
29 | /** |
||
30 | * @return CodeLimits[] |
||
31 | */ |
||
32 | public function getFunctionLimits() |
||
36 | |||
37 | protected function parse(Parser $parser) |
||
44 | |||
45 | protected function getCodeLimits(Node $node) |
||
55 | |||
56 | protected function addClass($classLimits) |
||
60 | |||
61 | protected function addFunction($classLimits) |
||
65 | |||
66 | protected function handleClass(Node $node) |
||
74 | |||
75 | protected function handleFunction(Node $node) |
||
79 | |||
80 | private function handleNamespace(Node $node) |
||
86 | |||
87 | /** |
||
88 | * @param $node |
||
89 | */ |
||
90 | protected function handleNode($node) |
||
105 | } |
||
106 |
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.