Conditions | 7 |
Paths | 12 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 56 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | public function compile($statement, Context $context) |
||
22 | { |
||
23 | if (count($statement->stmts) > 0) { |
||
24 | foreach ($statement->stmts as $stmt) { |
||
25 | \PHPSA\nodeVisitorFactory($stmt, $context); |
||
26 | } |
||
27 | } else { |
||
28 | $context->notice('not-implemented-body', 'Missing body', $statement); |
||
29 | } |
||
30 | |||
31 | if (count($statement->catches) > 0) { |
||
32 | foreach ($statement->catches as $stmt) { |
||
33 | \PHPSA\nodeVisitorFactory($stmt, $context); |
||
34 | } |
||
35 | } |
||
36 | |||
37 | if (count($statement->finallyStmts) > 0) { |
||
38 | foreach ($statement->finallyStmts as $stmt) { |
||
|
|||
39 | \PHPSA\nodeVisitorFactory($stmt, $context); |
||
40 | } |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 |
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.