Skip to content

Commit

Permalink
Merge pull request #1513 from rossriley/hotfix/class-exists-order
Browse files Browse the repository at this point in the history
Fix - change the order of instantiation checks
  • Loading branch information
goetas committed Oct 8, 2023
2 parents 544ff69 + e349907 commit 9b8dc5b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Metadata/Driver/DocBlockDriver/DocBlockTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,6 @@ private function resolveTypeFromTypeNode(TypeNode $typeNode, $reflector): string
*/
private function expandClassNameUsingUseStatements(string $typeHint, \ReflectionClass $declaringClass, $reflector): string
{
if ($this->isClassOrInterface($typeHint)) {
return $typeHint;
}

$expandedClassName = $declaringClass->getNamespaceName() . '\\' . $typeHint;
if ($this->isClassOrInterface($expandedClassName)) {
return $expandedClassName;
Expand Down Expand Up @@ -282,6 +278,10 @@ private function expandClassNameUsingUseStatements(string $typeHint, \Reflection
}
}

if ($this->isClassOrInterface($typeHint)) {
return $typeHint;
}

throw new \InvalidArgumentException(sprintf("Can't use incorrect type %s for collection in %s:%s", $typeHint, $declaringClass->getName(), $reflector->getName()));
}

Expand Down

0 comments on commit 9b8dc5b

Please sign in to comment.