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