diff --git a/src/PhpDoc/TypeNodeResolver.php b/src/PhpDoc/TypeNodeResolver.php index 953af9e1b9..257d1bba53 100644 --- a/src/PhpDoc/TypeNodeResolver.php +++ b/src/PhpDoc/TypeNodeResolver.php @@ -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);