File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717use PhpParser \Node \Name ;
1818use PhpParser \Node \Stmt \Class_ ;
1919use PhpParser \Node \Stmt \ClassLike ;
20+ use PhpParser \Node \Stmt \ClassMethod ;
2021use PHPStan \Analyser \Scope ;
2122use PHPStan \Reflection \ClassReflection ;
2223use PHPStan \Reflection \FunctionReflection ;
@@ -214,6 +215,22 @@ public function resolveFunctionLikeReflectionFromCall(
214215 return null ;
215216 }
216217
218+ /**
219+ * @api used in rector-laravel
220+ */
221+ public function resolveMethodReflectionFromClassMethod (ClassMethod $ classMethod , Scope $ scope ): ?MethodReflection
222+ {
223+ $ classReflection = $ scope ->getClassReflection ();
224+ if (! $ classReflection instanceof ClassReflection) {
225+ return null ;
226+ }
227+
228+ $ className = $ classReflection ->getName ();
229+ $ methodName = $ this ->nodeNameResolver ->getName ($ classMethod );
230+
231+ return $ this ->resolveMethodReflection ($ className , $ methodName , $ scope );
232+ }
233+
217234 public function resolveMethodReflectionFromNew (New_ $ new ): ?MethodReflection
218235 {
219236 $ newClassType = $ this ->nodeTypeResolver ->getType ($ new ->class );
You can’t perform that action at this time.
0 commit comments