| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | 5 | public function pass(Stmt $stmt, Context $context) |
|
| 25 | { |
||
| 26 | 5 | $yieldExists = $this->findYieldExpression([$stmt])->current(); |
|
| 27 | 5 | if (!$yieldExists) { |
|
| 28 | // YieldFrom is another expression |
||
| 29 | 5 | $yieldExists = $this->findNode([$stmt], Expr\YieldFrom::class)->current(); |
|
| 30 | 5 | } |
|
| 31 | |||
| 32 | 5 | if ($yieldExists && $this->findReturnStatement([$stmt])->current()) { |
|
| 33 | 1 | $context->notice('return_and_yield_in_one_method', 'Do not use return and yield in a one method', $stmt); |
|
| 34 | 1 | return true; |
|
| 35 | } |
||
| 36 | |||
| 37 | 5 | return false; |
|
| 38 | } |
||
| 39 | |||
| 50 |