File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
rules/CodeQuality/Rector/Class_ Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 66
77use PhpParser \Node ;
88use PhpParser \Node \Expr \Array_ ;
9+ use PhpParser \Node \Expr \Assign ;
10+ use PhpParser \Node \Expr \AssignOp ;
11+ use PhpParser \Node \Expr \AssignRef ;
912use PhpParser \Node \Expr \YieldFrom ;
1013use PhpParser \Node \Name \FullyQualified ;
1114use 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 }
You can’t perform that action at this time.
0 commit comments