@@ -171,19 +171,19 @@ private function expressionHasSideEffects(Expr $expr, Scope $scope): bool
171171 if ($ expr ->isFirstClassCallable ()) {
172172 return false ;
173173 }
174- if ($ expr ->name instanceof Name) {
175- if (! $ this -> reflectionProvider -> hasFunction ( $ expr -> name , $ scope )) {
176- return true ;
177- }
178- $ functionReflection = $ this ->reflectionProvider ->getFunction ($ expr ->name , $ scope );
179- $ hasSideEffects = $ functionReflection -> hasSideEffects () ;
180- if ( $ hasSideEffects -> yes ()) {
181- return true ;
182- }
183- if (! $ this -> rememberPossiblyImpureFunctionValues && ! $ hasSideEffects ->no ()) {
184- return true ;
185- }
186- } else {
174+ if (!( $ expr ->name instanceof Name) ) {
175+ return true ;
176+ }
177+
178+ if (! $ this ->reflectionProvider ->hasFunction ($ expr ->name , $ scope )) {
179+ return true ;
180+ }
181+ $ functionReflection = $ this -> reflectionProvider -> getFunction ( $ expr -> name , $ scope ) ;
182+ $ hasSideEffects = $ functionReflection -> hasSideEffects ();
183+ if ($ hasSideEffects ->yes ()) {
184+ return true ;
185+ }
186+ if (! $ this -> rememberPossiblyImpureFunctionValues && ! $ hasSideEffects -> no ()) {
187187 return true ;
188188 }
189189 foreach ($ expr ->getArgs () as $ arg ) {
@@ -198,17 +198,17 @@ private function expressionHasSideEffects(Expr $expr, Scope $scope): bool
198198 if ($ expr ->isFirstClassCallable ()) {
199199 return $ this ->expressionHasSideEffects ($ expr ->var , $ scope );
200200 }
201- if ($ expr ->name instanceof Node \Identifier) {
202- $ calledOnType = $ scope -> getType ( $ expr -> var ) ;
203- $ methodReflection = $ scope -> getMethodReflection ( $ calledOnType , $ expr -> name -> toString ());
204- if (
205- $ methodReflection === null
206- || $ methodReflection-> hasSideEffects ()-> yes ()
207- || (! $ this -> rememberPossiblyImpureFunctionValues && ! $ methodReflection -> hasSideEffects ()-> no ())
208- ) {
209- return true ;
210- }
211- } else {
201+ if (!( $ expr ->name instanceof Node \Identifier) ) {
202+ return true ;
203+ }
204+
205+ $ calledOnType = $ scope -> getType ( $ expr -> var );
206+ $ methodReflection = $ scope -> getMethodReflection ( $ calledOnType , $ expr -> name -> toString ());
207+ if (
208+ $ methodReflection === null
209+ || $ methodReflection -> hasSideEffects ()-> yes ()
210+ || (! $ this -> rememberPossiblyImpureFunctionValues && ! $ methodReflection -> hasSideEffects ()-> no ())
211+ ) {
212212 return true ;
213213 }
214214 foreach ($ expr ->getArgs () as $ arg ) {
@@ -226,21 +226,21 @@ private function expressionHasSideEffects(Expr $expr, Scope $scope): bool
226226 }
227227 return false ;
228228 }
229- if ($ expr ->name instanceof Node \Identifier) {
230- if ($ expr ->class instanceof Name) {
231- $ calledOnType = $ scope ->resolveTypeByName ($ expr ->class );
232- } else {
233- $ calledOnType = $ scope ->getType ($ expr ->class );
234- }
235- $ methodReflection = $ scope ->getMethodReflection ($ calledOnType , $ expr ->name ->toString ());
236- if (
237- $ methodReflection === null
238- || $ methodReflection ->hasSideEffects ()->yes ()
239- || (!$ this ->rememberPossiblyImpureFunctionValues && !$ methodReflection ->hasSideEffects ()->no ())
240- ) {
241- return true ;
242- }
229+ if (!($ expr ->name instanceof Node \Identifier)) {
230+ return true ;
231+ }
232+
233+ if ($ expr ->class instanceof Name) {
234+ $ calledOnType = $ scope ->resolveTypeByName ($ expr ->class );
243235 } else {
236+ $ calledOnType = $ scope ->getType ($ expr ->class );
237+ }
238+ $ methodReflection = $ scope ->getMethodReflection ($ calledOnType , $ expr ->name ->toString ());
239+ if (
240+ $ methodReflection === null
241+ || $ methodReflection ->hasSideEffects ()->yes ()
242+ || (!$ this ->rememberPossiblyImpureFunctionValues && !$ methodReflection ->hasSideEffects ()->no ())
243+ ) {
244244 return true ;
245245 }
246246 foreach ($ expr ->getArgs () as $ arg ) {
0 commit comments