diff --git a/src/Psalm/Internal/Codebase/Populator.php b/src/Psalm/Internal/Codebase/Populator.php index 1bbb04390..c058f88e7 100644 --- a/src/Psalm/Internal/Codebase/Populator.php +++ b/src/Psalm/Internal/Codebase/Populator.php @@ -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); diff --git a/tests/Template/TemplateExtendsTest.php b/tests/Template/TemplateExtendsTest.php index ac9c66287..6a43f80d5 100644 --- a/tests/Template/TemplateExtendsTest.php +++ b/tests/Template/TemplateExtendsTest.php @@ -1937,6 +1937,44 @@ class TemplateExtendsTest extends TestCase } }' ], + 'interfaceParentExtends' => [ + ' */ + interface FooChild extends Foo {} + + class F implements FooChild { + public function getValue() { + return 10; + } + } + + echo (new F())->getValue();' + ], + 'classParentExtends' => [ + ' */ + abstract class FooChild extends Foo {} + + class F extends FooChild { + public function getValue() { + return 10; + } + } + + echo (new F())->getValue();' + ], ]; }