From 422d9944d88e01ae67235e65346b30faa9cf7e3b Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Thu, 4 Jul 2019 22:39:28 -0400 Subject: [PATCH] Fix #1903 - inherit @method from parent interfaces --- src/Psalm/Internal/Codebase/Populator.php | 2 ++ tests/MagicMethodAnnotationTest.php | 31 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/Psalm/Internal/Codebase/Populator.php b/src/Psalm/Internal/Codebase/Populator.php index 1b168fb115e..d7cc4ca28eb 100644 --- a/src/Psalm/Internal/Codebase/Populator.php +++ b/src/Psalm/Internal/Codebase/Populator.php @@ -640,6 +640,8 @@ private function populateInterfaceDataFromParentInterfaces( $parent_interfaces = array_merge($parent_interfaces, $parent_interface_storage->parent_interfaces); $this->inheritMethodsFromParent($storage, $parent_interface_storage); + + $storage->pseudo_methods += $parent_interface_storage->pseudo_methods; } $storage->parent_interfaces = array_merge($parent_interfaces, $storage->parent_interfaces); diff --git a/tests/MagicMethodAnnotationTest.php b/tests/MagicMethodAnnotationTest.php index cfdcfd1e5a3..211286b8564 100644 --- a/tests/MagicMethodAnnotationTest.php +++ b/tests/MagicMethodAnnotationTest.php @@ -414,6 +414,37 @@ function sayHello() : string { echo makeConcrete()->sayHello();' ], + 'inheritInterfacePseudoMethodsFromParent' => [ + 'getClassMetadata()); + test(concreteEm()->getClassMetadata()); + + test2(em()->getOtherMetadata()); + test2(concreteEm()->getOtherMetadata());' + ], ]; }