mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix #1766 - interpret interface parent extends properly
This commit is contained in:
parent
010f911d22
commit
7cf8c362f0
@ -701,6 +701,11 @@ class Populator
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($implemented_interface_storage->template_type_extends) {
|
||||
$storage->template_type_extends = array_merge(
|
||||
$storage->template_type_extends ?: [],
|
||||
$implemented_interface_storage->template_type_extends
|
||||
);
|
||||
}
|
||||
|
||||
$extra_interfaces = array_merge($extra_interfaces, $implemented_interface_storage->parent_interfaces);
|
||||
|
@ -1937,6 +1937,44 @@ class TemplateExtendsTest extends TestCase
|
||||
}
|
||||
}'
|
||||
],
|
||||
'interfaceParentExtends' => [
|
||||
'<?php
|
||||
/** @template T */
|
||||
interface Foo {
|
||||
/** @return T */
|
||||
public function getValue();
|
||||
}
|
||||
|
||||
/** @extends Foo<int> */
|
||||
interface FooChild extends Foo {}
|
||||
|
||||
class F implements FooChild {
|
||||
public function getValue() {
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
|
||||
echo (new F())->getValue();'
|
||||
],
|
||||
'classParentExtends' => [
|
||||
'<?php
|
||||
/** @template T */
|
||||
abstract class Foo {
|
||||
/** @return T */
|
||||
abstract public function getValue();
|
||||
}
|
||||
|
||||
/** @extends Foo<int> */
|
||||
abstract class FooChild extends Foo {}
|
||||
|
||||
class F extends FooChild {
|
||||
public function getValue() {
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
|
||||
echo (new F())->getValue();'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user