public function pass(Stmt $stmt, Context $context)
{
$yieldExists = \PHPSA\generatorHasValue($this->findYieldExpression([$stmt]));
if (!$yieldExists) {
// YieldFrom is another expression
$yieldExists = \PHPSA\generatorHasValue($this->findNode([$stmt], Expr\YieldFrom::class));
}
if ($yieldExists && \PHPSA\generatorHasValue($this->findReturnStatement([$stmt]))) {
$context->notice('return_and_yield_in_one_method', 'Do not use return and yield in a one method', $stmt);
return true;
}
return false;
}