| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public function pass($stmt, Context $context) |
||
| 33 | { |
||
| 34 | $condition = $stmt->cond; |
||
| 35 | |||
| 36 | if ($stmt instanceof For_ && count($stmt->cond) > 0) { // For is the only one that has an array as condition |
||
| 37 | $condition = $condition[0]; |
||
| 38 | } |
||
| 39 | |||
| 40 | if ($condition instanceof Assign) { |
||
| 41 | $context->notice( |
||
| 42 | 'assignment_in_condition', |
||
| 43 | 'An assignment statement has been made instead of conditional statement', |
||
| 44 | $stmt |
||
| 45 | ); |
||
| 46 | return true; |
||
| 47 | } |
||
| 48 | |||
| 49 | return false; |
||
| 50 | } |
||
| 51 | |||
| 67 |