| Conditions | 5 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | 5 | public function pass(Return_ $stmt, Context $context) |
|
| 23 | { |
||
| 24 | // this is not the value null but "no value" |
||
| 25 | 5 | if ($stmt->expr === null) { |
|
| 26 | 1 | $scopePointer = $context->scopePointer; |
|
| 27 | 1 | if ($scopePointer && $scopePointer->isClassMethod()) { |
|
| 28 | /** @var \PHPSA\Definition\ClassMethod $method */ |
||
| 29 | 1 | $method = $scopePointer->getObject(); |
|
| 30 | 1 | if ($method->getReturnType() == CompiledExpression::VOID) { |
|
| 31 | 1 | return false; |
|
| 32 | } |
||
| 33 | 1 | } |
|
| 34 | |||
| 35 | |||
| 36 | 1 | $context->notice( |
|
| 37 | 1 | 'return.void', |
|
| 38 | 1 | 'You are trying to return void', |
|
| 39 | $stmt |
||
| 40 | 1 | ); |
|
| 41 | |||
| 42 | 1 | return true; |
|
| 43 | } |
||
| 44 | |||
| 45 | 5 | return false; |
|
| 46 | } |
||
| 47 | |||
| 58 |