Skip to content

Commit 131fa27

Browse files
committed
fix: fix phpstan errors.
1 parent 66e94a6 commit 131fa27

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/Parse/VariableParser.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

src/Parse/Visitor/FunctionLikeFindingVisitor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ public function leaveNode(Node $node) {
4949
// Reset because it leaves the class scope
5050
$this->currentClass = null;
5151
}
52+
return parent::leaveNode($node);
5253
}
5354
}

0 commit comments

Comments
 (0)