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