2222use Rector \Comments \NodeDocBlock \DocBlockUpdater ;
2323use Rector \DeadCode \NodeAnalyzer \IsClassMethodUsedAnalyzer ;
2424use Rector \NodeTypeResolver \Node \AttributeKey ;
25- use Rector \PhpParser \Node \BetterNodeFinder ;
2625use Rector \PhpParser \NodeTransformer ;
2726use Rector \PHPStan \ScopeFetcher ;
2827use Rector \PHPUnit \NodeAnalyzer \TestsNodeAnalyzer ;
@@ -47,7 +46,6 @@ public function __construct(
4746 private readonly IsClassMethodUsedAnalyzer $ isClassMethodUsedAnalyzer ,
4847 private readonly PhpDocTypeChanger $ phpDocTypeChanger ,
4948 private readonly DocBlockUpdater $ docBlockUpdater ,
50- private readonly BetterNodeFinder $ betterNodeFinder ,
5149 ) {
5250 }
5351
@@ -137,24 +135,21 @@ private function collectReturnArrayNodesFromClassMethod(ClassMethod $classMethod
137135 if ($ statement instanceof Expression) {
138136 $ statement = $ statement ->expr ;
139137 }
140-
141138 if ($ statement instanceof Return_) {
142139 $ returnedExpr = $ statement ->expr ;
143-
144140 if (! $ returnedExpr instanceof Array_) {
145141 return null ;
146142 }
147-
148143 return $ returnedExpr ;
149- } elseif ($ statement instanceof YieldFrom) {
144+ }
145+
146+ if ($ statement instanceof YieldFrom) {
150147 if (! $ statement ->expr instanceof Array_) {
151148 return null ;
152149 }
153-
154- if ($ yieldedFromExpr !== null ) {
150+ if ($ yieldedFromExpr instanceof Array_) {
155151 return null ;
156152 }
157-
158153 $ yieldedFromExpr = $ statement ->expr ;
159154 } elseif (
160155 ! $ statement instanceof Assign
0 commit comments