Skip to content

Commit

Permalink
Make condition clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanvelzen committed Apr 8, 2022
1 parent 4945c38 commit d07a223
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/PhpDoc/TypeNodeResolver.php
Expand Up @@ -366,13 +366,11 @@ private function resolveIdentifierTypeNode(IdentifierTypeNode $typeNode, NameSco
return new ErrorType();
}

if (!$this->mightBeConstant($typeNode->name) || $this->getReflectionProvider()->hasClass($stringName)) {
return new ObjectType($stringName);
}

$constType = $this->tryResolveConstant($typeNode->name, $nameScope);
if ($constType !== null) {
return $constType;
if ($this->mightBeConstant($typeNode->name) && !$this->getReflectionProvider()->hasClass($stringName)) {
$constType = $this->tryResolveConstant($typeNode->name, $nameScope);
if ($constType !== null) {
return $constType;
}
}

return new ObjectType($stringName);
Expand Down

0 comments on commit d07a223

Please sign in to comment.