@@ -138,6 +138,11 @@ public function resolveMethodReflection(string $className, string $methodName, ?
138138
139139 public function resolveMethodReflectionFromStaticCall (StaticCall $ staticCall ): ?MethodReflection
140140 {
141+ $ methodName = $ this ->nodeNameResolver ->getName ($ staticCall ->name );
142+ if ($ methodName === null ) {
143+ return null ;
144+ }
145+
141146 $ objectType = $ this ->nodeTypeResolver ->getType ($ staticCall ->class );
142147
143148 if ($ objectType instanceof ShortenedObjectType || $ objectType instanceof AliasedObjectType) {
@@ -148,11 +153,6 @@ public function resolveMethodReflectionFromStaticCall(StaticCall $staticCall): ?
148153 $ classNames = $ objectType ->getObjectClassNames ();
149154 }
150155
151- $ methodName = $ this ->nodeNameResolver ->getName ($ staticCall ->name );
152- if ($ methodName === null ) {
153- return null ;
154- }
155-
156156 $ scope = $ staticCall ->getAttribute (AttributeKey::SCOPE );
157157
158158 foreach ($ classNames as $ className ) {
@@ -167,20 +167,18 @@ public function resolveMethodReflectionFromStaticCall(StaticCall $staticCall): ?
167167
168168 public function resolveMethodReflectionFromMethodCall (MethodCall $ methodCall ): ?MethodReflection
169169 {
170- $ callerType = $ this ->nodeTypeResolver ->getType ($ methodCall ->var );
170+ $ methodName = $ this ->nodeNameResolver ->getName ($ methodCall ->name );
171+ if ($ methodName === null ) {
172+ return null ;
173+ }
171174
175+ $ callerType = $ this ->nodeTypeResolver ->getType ($ methodCall ->var );
172176 if ($ callerType instanceof BenevolentUnionType) {
173177 $ callerType = TypeCombinator ::removeFalsey ($ callerType );
174178 }
175179
176180 $ className = ClassNameFromObjectTypeResolver ::resolve ($ callerType );
177181 if ($ className === null ) {
178-
179- return null ;
180- }
181-
182- $ methodName = $ this ->nodeNameResolver ->getName ($ methodCall ->name );
183- if ($ methodName === null ) {
184182 return null ;
185183 }
186184
0 commit comments