| Conditions | 7 |
| Paths | 4 |
| Total Lines | 30 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 17 |
| CRAP Score | 7.0084 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 12 | public function pass(ClassMethod $methodStmt, Context $context) |
|
| 27 | { |
||
| 28 | 12 | if ($methodStmt->stmts === null) { |
|
| 29 | 1 | return false; |
|
| 30 | } |
||
| 31 | |||
| 32 | 12 | if (count($methodStmt->stmts) == 0) { |
|
| 33 | 2 | return false; |
|
| 34 | } |
||
| 35 | |||
| 36 | 11 | $result = false; |
|
| 37 | |||
| 38 | 11 | if ($methodStmt->name == '__construct' || $methodStmt->name == '__destruct') { |
|
| 39 | 2 | foreach ($this->findReturnStatement($methodStmt->stmts) as $returnStmt) { |
|
| 40 | 1 | if (!$returnStmt->expr) { |
|
| 41 | continue; |
||
| 42 | } |
||
| 43 | |||
| 44 | 1 | $context->notice( |
|
| 45 | 1 | 'return.construct', |
|
| 46 | 1 | sprintf('Method %s cannot return a value.', $methodStmt->name), |
|
| 47 | $returnStmt |
||
| 48 | 1 | ); |
|
| 49 | |||
| 50 | 1 | $result = true; |
|
| 51 | 2 | } |
|
| 52 | 2 | } |
|
| 53 | |||
| 54 | 11 | return $result; |
|
| 55 | } |
||
| 56 | |||
| 67 |