From 97f702664b18b327ce06e504739b55a493907b10 Mon Sep 17 00:00:00 2001 From: Richard van Velzen Date: Fri, 8 Apr 2022 10:18:14 +0200 Subject: [PATCH] Make condition clearer --- src/PhpDoc/TypeNodeResolver.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) 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);