Skip to content

Commit

Permalink
Merge pull request #421 from ben-challis/cs-fixer
Browse files Browse the repository at this point in the history
Fix reference consistency in `NameResolver` to resolve CI issues
  • Loading branch information
fain182 authored Jan 16, 2024
2 parents cc7b3a0 + aaf58ae commit 6c574a7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Analyzer/NameResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use PhpParser\Node\Name;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Use_;
use PhpParser\NodeAbstract;
use PhpParser\NodeVisitorAbstract;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode;
Expand Down Expand Up @@ -161,14 +160,14 @@ public function enterNode(Node $node)
}

if (null !== $arrayItemType) {
$node->type = $this->resolveName(new Node\Name($arrayItemType), Use_::TYPE_NORMAL);
$node->type = $this->resolveName(new Name($arrayItemType), Stmt\Use_::TYPE_NORMAL);

return;
}
}

foreach ($phpDocNode->getVarTagValues() as $tagValue) {
$type = $this->resolveName(new Node\Name((string) $tagValue->type), Use_::TYPE_NORMAL);
$type = $this->resolveName(new Name((string) $tagValue->type), Stmt\Use_::TYPE_NORMAL);
$node->type = $type;
break;
}
Expand All @@ -177,7 +176,7 @@ public function enterNode(Node $node)
foreach ($phpDocNode->getTags() as $tagValue) {
if ('@' === $tagValue->name[0] && !str_contains($tagValue->name, '@var')) {
$customTag = str_replace('@', '', $tagValue->name);
$type = $this->resolveName(new Node\Name($customTag), Use_::TYPE_NORMAL);
$type = $this->resolveName(new Name($customTag), Stmt\Use_::TYPE_NORMAL);
$node->type = $type;

break;
Expand Down Expand Up @@ -339,7 +338,7 @@ private function resolveSignature($node): void
$arrayItemType = $this->getArrayItemType($phpDocParam->type);

if (null !== $arrayItemType) {
$param->type = $this->resolveName(new Node\Name($arrayItemType), Use_::TYPE_NORMAL);
$param->type = $this->resolveName(new Name($arrayItemType), Stmt\Use_::TYPE_NORMAL);
}
}
}
Expand All @@ -356,7 +355,7 @@ private function resolveSignature($node): void
}

if (null !== $arrayItemType) {
$node->returnType = $this->resolveName(new Node\Name($arrayItemType), Use_::TYPE_NORMAL);
$node->returnType = $this->resolveName(new Name($arrayItemType), Stmt\Use_::TYPE_NORMAL);
}
}
}
Expand Down

0 comments on commit 6c574a7

Please sign in to comment.