| Conditions | 7 |
| Paths | 3 |
| Total Lines | 28 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 25.4573 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 21 | 6 | public function pass(ClassMethod $methodStmt, Context $context) |
|
| 22 | { |
||
| 23 | 6 | if (count($methodStmt->stmts) == 0) { |
|
| 24 | return false; |
||
| 25 | } |
||
| 26 | |||
| 27 | 6 | $result = false; |
|
| 28 | |||
| 29 | 6 | if ($methodStmt->name == '__construct' || $methodStmt->name == '__destruct') { |
|
| 30 | foreach ($methodStmt->stmts as $stmt) { |
||
| 31 | if ($stmt instanceof Return_) { |
||
| 32 | if (!$stmt->expr) { |
||
| 33 | continue; |
||
| 34 | } |
||
| 35 | |||
| 36 | $context->notice( |
||
| 37 | 'return.construct', |
||
| 38 | sprintf('Method %s cannot return a value.', $methodStmt->name), |
||
| 39 | $stmt |
||
| 40 | ); |
||
| 41 | |||
| 42 | $result = true; |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | 6 | return $result; |
|
| 48 | } |
||
| 49 | |||
| 63 |