mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Fix templated class conversion allowing child class
This commit is contained in:
parent
2c55e7aabb
commit
3ca5ec9281
@ -804,7 +804,7 @@ class AssertionFinder
|
||||
if ($var_type->from_docblock || $other_type->from_docblock) {
|
||||
if (IssueBuffer::accepts(
|
||||
new DocblockTypeContradiction(
|
||||
$var_type . ' does not contain ' . $other_type,
|
||||
$var_type->getId() . ' does not contain ' . $other_type->getId(),
|
||||
new CodeLocation($source, $conditional)
|
||||
),
|
||||
$source->getSuppressedIssues()
|
||||
|
@ -997,7 +997,7 @@ class Union
|
||||
|
||||
$new_types[$unknown_class_string->getKey()] = $unknown_class_string;
|
||||
} elseif ($template_type_part instanceof Type\Atomic\TNamedObject) {
|
||||
$literal_class_string = new Type\Atomic\TLiteralClassString($template_type_part->value);
|
||||
$literal_class_string = new Type\Atomic\TClassString($template_type_part->value);
|
||||
|
||||
$new_types[$literal_class_string->getKey()] = $literal_class_string;
|
||||
}
|
||||
|
@ -1233,6 +1233,13 @@ class TemplateTest extends TestCase
|
||||
|
||||
echo $object->id;
|
||||
}
|
||||
}
|
||||
|
||||
class FooChild extends Foo {}
|
||||
|
||||
/** @param Collection<Foo> $c */
|
||||
function handleCollectionOfFoo(Collection $c) : void {
|
||||
if ($c->getType() === FooChild::class) {}
|
||||
}',
|
||||
],
|
||||
'getEquateClass' => [
|
||||
|
Loading…
Reference in New Issue
Block a user