Skip to content

Commit

Permalink
Resolve unknown generic type to bound instead of ErrorType
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Feb 11, 2021
1 parent 6062437 commit 6ef87d1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Reflection/ClassReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ public function typeMapToList(TemplateTypeMap $typeMap): array

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

return $list;
Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Analyser/data/generics.php
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ function cache1($t): void {
function newHandling(): void {
assertType('PHPStan\Generics\FunctionsAssertType\C<mixed>', new C());
assertType('PHPStan\Generics\FunctionsAssertType\A<stdClass>', new A(new \stdClass()));
assertType('PHPStan\Generics\FunctionsAssertType\A<*ERROR*>', new A());
assertType('PHPStan\Generics\FunctionsAssertType\A<mixed>', new A());
}

/**
Expand Down

0 comments on commit 6ef87d1

Please sign in to comment.