@@ -102,14 +102,14 @@ public function provideMinPhpVersion(): int
102102 return PhpVersionFeature::ARRAY_ALL ;
103103 }
104104
105- private function refactorBooleanAssignmentPattern (StmtsAwareInterface $ node ): ?Node
105+ private function refactorBooleanAssignmentPattern (StmtsAwareInterface $ stmtsAware ): ?Node
106106 {
107- foreach ($ node ->stmts as $ key => $ stmt ) {
107+ foreach ($ stmtsAware ->stmts as $ key => $ stmt ) {
108108 if (! $ stmt instanceof Foreach_) {
109109 continue ;
110110 }
111111
112- $ prevStmt = $ node ->stmts [$ key - 1 ] ?? null ;
112+ $ prevStmt = $ stmtsAware ->stmts [$ key - 1 ] ?? null ;
113113 if (! $ prevStmt instanceof Expression) {
114114 continue ;
115115 }
@@ -136,7 +136,7 @@ private function refactorBooleanAssignmentPattern(StmtsAwareInterface $node): ?N
136136 }
137137
138138 if ($ this ->stmtsManipulator ->isVariableUsedInNextStmt (
139- $ node ,
139+ $ stmtsAware ,
140140 $ key + 1 ,
141141 (string ) $ this ->getName ($ foreach ->valueVar )
142142 )) {
@@ -174,26 +174,26 @@ private function refactorBooleanAssignmentPattern(StmtsAwareInterface $node): ?N
174174 $ newAssign = new Assign ($ assignedVariable , $ funcCall );
175175 $ newExpression = new Expression ($ newAssign );
176176
177- unset($ node ->stmts [$ key - 1 ]);
178- $ node ->stmts [$ key ] = $ newExpression ;
177+ unset($ stmtsAware ->stmts [$ key - 1 ]);
178+ $ stmtsAware ->stmts [$ key ] = $ newExpression ;
179179
180- $ node ->stmts = array_values ($ node ->stmts );
180+ $ stmtsAware ->stmts = array_values ($ stmtsAware ->stmts );
181181
182- return $ node ;
182+ return $ stmtsAware ;
183183 }
184184
185185 return null ;
186186 }
187187
188- private function refactorEarlyReturnPattern (StmtsAwareInterface $ node ): ?Node
188+ private function refactorEarlyReturnPattern (StmtsAwareInterface $ stmtsAware ): ?Node
189189 {
190- foreach ($ node ->stmts as $ key => $ stmt ) {
190+ foreach ($ stmtsAware ->stmts as $ key => $ stmt ) {
191191 if (! $ stmt instanceof Foreach_) {
192192 continue ;
193193 }
194194
195195 $ foreach = $ stmt ;
196- $ nextStmt = $ node ->stmts [$ key + 1 ] ?? null ;
196+ $ nextStmt = $ stmtsAware ->stmts [$ key + 1 ] ?? null ;
197197
198198 if (! $ nextStmt instanceof Return_) {
199199 continue ;
@@ -236,11 +236,11 @@ private function refactorEarlyReturnPattern(StmtsAwareInterface $node): ?Node
236236
237237 $ funcCall = $ this ->nodeFactory ->createFuncCall ('array_all ' , [$ foreach ->expr , $ arrowFunction ]);
238238
239- $ node ->stmts [$ key ] = new Return_ ($ funcCall );
240- unset($ node ->stmts [$ key + 1 ]);
241- $ node ->stmts = array_values ($ node ->stmts );
239+ $ stmtsAware ->stmts [$ key ] = new Return_ ($ funcCall );
240+ unset($ stmtsAware ->stmts [$ key + 1 ]);
241+ $ stmtsAware ->stmts = array_values ($ stmtsAware ->stmts );
242242
243- return $ node ;
243+ return $ stmtsAware ;
244244 }
245245
246246 return null ;
0 commit comments