@@ -25,30 +25,18 @@ public function __construct()
2525 $ this ->nodeFinder = new NodeFinder ();
2626 }
2727
28- /**
29- * @param array<\PhpParser\Node\Stmt> $stmts
30- * @return array<\PhpParser\Node\Stmt>
31- */
32- private function resolveNames (array $ stmts ): array
33- {
34- $ nameResolver = new NameResolver ();
35- $ nodeTraverser = new NodeTraverser ();
36- $ nodeTraverser ->addVisitor ($ nameResolver );
37- return $ nodeTraverser ->traverse ($ stmts );
38- }
39-
4028 public function parse (string $ content ): ParseResult
4129 {
4230 $ stmts = $ this ->parser ->parse ($ content );
4331 if ($ stmts === null ) {
4432 throw new ParseFailedException ();
4533 }
46- $ stmts = $ this ->resolveNames ($ stmts );
4734
4835 $ traverser = new NodeTraverser ();
4936 $ visitor = new FunctionLikeFindingVisitor (fn ($ node ) => $ node instanceof FunctionLike);
5037 $ traverser ->addVisitor ($ visitor );
5138 $ traverser ->traverse ($ stmts );
39+ /** @var list<FunctionLike> */
5240 $ functionLikes = $ visitor ->getFoundNodes ();
5341
5442 $ functions = $ this ->collectParseResultPerFunctionLike ($ functionLikes );
@@ -63,6 +51,7 @@ public function parse(string $content): ParseResult
6351 private function collectParseResultPerFunctionLike (array $ functionLikes ): array
6452 {
6553 return array_map (function (FunctionLike $ function ) {
54+ /** @var string|null */
6655 $ namespace = $ function ->getAttribute ('namespace ' ); // Get the namespace name set in FunctionLikeFindingVisitor
6756 $ className = $ function ->getAttribute ('className ' ); // Get the class name set in FunctionLikeFindingVisitor
6857 $ functionName = $ function ->name ->name ?? $ function ->getType () . '@ ' . $ function ->getStartLine ();
0 commit comments