@@ -25,30 +25,18 @@ public function __construct()
25
25
$ this ->nodeFinder = new NodeFinder ();
26
26
}
27
27
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
-
40
28
public function parse (string $ content ): ParseResult
41
29
{
42
30
$ stmts = $ this ->parser ->parse ($ content );
43
31
if ($ stmts === null ) {
44
32
throw new ParseFailedException ();
45
33
}
46
- $ stmts = $ this ->resolveNames ($ stmts );
47
34
48
35
$ traverser = new NodeTraverser ();
49
36
$ visitor = new FunctionLikeFindingVisitor (fn ($ node ) => $ node instanceof FunctionLike);
50
37
$ traverser ->addVisitor ($ visitor );
51
38
$ traverser ->traverse ($ stmts );
39
+ /** @var list<FunctionLike> */
52
40
$ functionLikes = $ visitor ->getFoundNodes ();
53
41
54
42
$ functions = $ this ->collectParseResultPerFunctionLike ($ functionLikes );
@@ -63,6 +51,7 @@ public function parse(string $content): ParseResult
63
51
private function collectParseResultPerFunctionLike (array $ functionLikes ): array
64
52
{
65
53
return array_map (function (FunctionLike $ function ) {
54
+ /** @var string|null */
66
55
$ namespace = $ function ->getAttribute ('namespace ' ); // Get the namespace name set in FunctionLikeFindingVisitor
67
56
$ className = $ function ->getAttribute ('className ' ); // Get the class name set in FunctionLikeFindingVisitor
68
57
$ functionName = $ function ->name ->name ?? $ function ->getType () . '@ ' . $ function ->getStartLine ();
0 commit comments