| Conditions | 5 |
| Paths | 6 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 2 | ||
| 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->finallyStmts) > 0) { |
||
| 32 | foreach ($statement->finallyStmts as $stmt) { |
||
|
|
|||
| 33 | \PHPSA\nodeVisitorFactory($stmt, $context); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | } |
||
| 37 | } |
||
| 38 |
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.