Skip to content

Commit eca878f

Browse files
committed
rector
1 parent 4d10c62 commit eca878f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

rules/CodeQuality/Rector/Class_/YieldDataProviderRector.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
use PhpParser\Node;
88
use PhpParser\Node\Expr\Array_;
9+
use PhpParser\Node\Expr\Assign;
10+
use PhpParser\Node\Expr\AssignOp;
11+
use PhpParser\Node\Expr\AssignRef;
912
use PhpParser\Node\Expr\YieldFrom;
1013
use PhpParser\Node\Name\FullyQualified;
1114
use PhpParser\Node\Stmt\Class_;
@@ -127,8 +130,6 @@ private function collectReturnArrayNodesFromClassMethod(ClassMethod $classMethod
127130
return null;
128131
}
129132

130-
$totalStmts = count($classMethod->stmts);
131-
132133
$yieldOrReturn = null;
133134
foreach ($classMethod->stmts as $statement) {
134135
if ($statement instanceof Expression) {
@@ -142,15 +143,15 @@ private function collectReturnArrayNodesFromClassMethod(ClassMethod $classMethod
142143
return null;
143144
}
144145

145-
if ($yieldOrReturn !== null) {
146+
if ($yieldOrReturn instanceof Array_) {
146147
return null;
147148
}
148149

149150
$yieldOrReturn = $returnedExpr;
150151
} elseif (
151-
!$statement instanceof Node\Expr\Assign
152-
&& !$statement instanceof Node\Expr\AssignRef
153-
&& !$statement instanceof Node\Expr\AssignOp
152+
! $statement instanceof Assign
153+
&& ! $statement instanceof AssignRef
154+
&& ! $statement instanceof AssignOp
154155
) {
155156
return null;
156157
}

0 commit comments

Comments
 (0)