| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | 17 | public function pass($stmt, Context $context) |
|
| 28 | { |
||
| 29 | 17 | $condition = $stmt->cond; |
|
| 30 | |||
| 31 | 17 | if ($stmt instanceof For_ && count($stmt->cond) > 0) { // For is the only one that has an array as condition |
|
| 32 | 3 | $condition = $condition[0]; |
|
| 33 | 3 | } |
|
| 34 | |||
| 35 | 17 | if ($condition instanceof Assign) { |
|
| 36 | 5 | $context->notice( |
|
| 37 | 5 | 'assignment_in_condition', |
|
| 38 | 5 | 'An assignment statement has been made instead of conditional statement', |
|
| 39 | $stmt |
||
| 40 | 5 | ); |
|
| 41 | 5 | return true; |
|
| 42 | } |
||
| 43 | |||
| 44 | 13 | return false; |
|
| 45 | } |
||
| 46 | |||
| 62 |