Skip to content

Commit 4fc7fa3

Browse files
shmaxondrejmirtes
authored andcommitted
remove unnecessary BC coverage from generic type alias resolution
Amp-Thread-ID: https://ampcode.com/threads/T-01a19219-5899-7222-8fa0-6cb7e6fb7182
1 parent b98bccd commit 4fc7fa3

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

‎src/PhpDoc/TypeNodeResolver.php‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -876,17 +876,8 @@ static function (string $variance): TemplateTypeVariance {
876876
}
877877

878878
// Check for a generic type alias (e.g. MyList<string>) before falling through to
879-
// class-based generic resolution, but only when the name is not itself a resolvable
880-
// class — in that case the class-based path must win to preserve backward compatibility
881-
// (a type alias like BelongsTo<T, U> = \Eloquent\BelongsTo<T, U> should still produce
882-
// the same GenericObjectType that class-based resolution would have given).
883-
$genericTypeAlias = null;
884-
if ($typeNode->type instanceof IdentifierTypeNode) {
885-
$resolvedGenericName = $nameScope->resolveStringName($typeNode->type->name);
886-
$genericTypeAlias = !$this->getReflectionProvider()->hasClass($resolvedGenericName)
887-
? $this->findGenericTypeAlias($typeNode->type->name, $nameScope)
888-
: null;
889-
}
879+
// class-based generic resolution.
880+
$genericTypeAlias = $typeNode->type instanceof IdentifierTypeNode ? $this->findGenericTypeAlias($typeNode->type->name, $nameScope) : null;
890881
if ($genericTypeAlias !== null) {
891882
$templateNodes = $genericTypeAlias->getTemplateTagValueNodes();
892883
$totalParams = count($templateNodes);

0 commit comments

Comments
 (0)