We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dd37fe9 commit f486e3eCopy full SHA for f486e3e
src/Extracting/MethodAstParser.php
@@ -5,6 +5,8 @@
5
use Exception;
6
use PhpParser\Node;
7
use PhpParser\NodeFinder;
8
+use PhpParser\NodeTraverser;
9
+use PhpParser\NodeVisitor\NameResolver;
10
use PhpParser\ParserFactory;
11
use ReflectionFunctionAbstract;
12
use Throwable;
@@ -50,6 +52,13 @@ protected static function parseClassSourceCode(string $sourceCode): ?array
50
52
throw new Exception("Parse error: {$error->getMessage()}");
51
53
}
54
55
+ $traverser = new NodeTraverser(new NameResolver(options: ['replaceNodes' => false]));
56
+ try {
57
+ $traverser->traverse($ast);
58
+ } catch (Throwable $error) {
59
+ throw new Exception("Traverse error: {$error->getMessage()}");
60
+ }
61
+
62
return $ast;
63
64
0 commit comments