Skip to content

Commit 6ef87d1

Browse files
committed
Resolve unknown generic type to bound instead of ErrorType
1 parent 6062437 commit 6ef87d1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Reflection/ClassReflection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ public function typeMapToList(TemplateTypeMap $typeMap): array
897897

898898
$list = [];
899899
foreach ($resolvedPhpDoc->getTemplateTags() as $tag) {
900-
$list[] = $typeMap->getType($tag->getName()) ?? new ErrorType();
900+
$list[] = $typeMap->getType($tag->getName()) ?? $tag->getBound();
901901
}
902902

903903
return $list;

tests/PHPStan/Analyser/data/generics.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ function cache1($t): void {
883883
function newHandling(): void {
884884
assertType('PHPStan\Generics\FunctionsAssertType\C<mixed>', new C());
885885
assertType('PHPStan\Generics\FunctionsAssertType\A<stdClass>', new A(new \stdClass()));
886-
assertType('PHPStan\Generics\FunctionsAssertType\A<*ERROR*>', new A());
886+
assertType('PHPStan\Generics\FunctionsAssertType\A<mixed>', new A());
887887
}
888888

889889
/**

0 commit comments

Comments
 (0)