| 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 |
||
| 28 | 14 | public function pass($stmt, Context $context) |
|
| 29 | { |
||
| 30 | 14 | $condition = $stmt->cond; |
|
| 31 | |||
| 32 | 14 | if ($stmt instanceof For_ && count($stmt->cond) > 0) { // For is the only one that has an array as condition |
|
| 33 | 2 | $condition = $condition[0]; |
|
| 34 | 2 | } |
|
| 35 | |||
| 36 | 14 | if ($condition instanceof Assign) { |
|
| 37 | 5 | $context->notice( |
|
| 38 | 5 | 'assignment_in_condition', |
|
| 39 | 5 | 'An assignment statement has been made instead of conditional statement', |
|
| 40 | $stmt |
||
| 41 | 5 | ); |
|
| 42 | 5 | return true; |
|
| 43 | } |
||
| 44 | |||
| 45 | 10 | return false; |
|
| 46 | } |
||
| 47 | |||
| 75 |