diff --git a/src/Psalm/Internal/Codebase/Methods.php b/src/Psalm/Internal/Codebase/Methods.php index 4db90ade8..7458c0a0f 100644 --- a/src/Psalm/Internal/Codebase/Methods.php +++ b/src/Psalm/Internal/Codebase/Methods.php @@ -762,9 +762,7 @@ class Methods $self_class = $overridden_class_storage->name; - if ($candidate_type - && $source_analyzer - ) { + if ($candidate_type && $source_analyzer && !$candidate_type->isMixed()) { $old_contained_by_new = UnionTypeComparator::isContainedBy( $source_analyzer->getCodebase(), $candidate_type, diff --git a/src/Psalm/Internal/Codebase/Populator.php b/src/Psalm/Internal/Codebase/Populator.php index 3c20018fb..af4763edb 100644 --- a/src/Psalm/Internal/Codebase/Populator.php +++ b/src/Psalm/Internal/Codebase/Populator.php @@ -311,7 +311,12 @@ class Populator if ($declaring_method_storage->has_docblock_param_types && !$method_storage->has_docblock_param_types - && !isset($storage->documenting_method_ids[$method_name]) + && (!isset($storage->documenting_method_ids[$method_name]) + || \in_array( + $storage->documenting_method_ids[$method_name]->fq_class_name, + $declaring_class_storage->parent_interfaces + ) + ) ) { $storage->documenting_method_ids[$method_name] = $declaring_method_id; } diff --git a/tests/Template/ClassTemplateExtendsTest.php b/tests/Template/ClassTemplateExtendsTest.php index a6ae12510..1e727b5a1 100644 --- a/tests/Template/ClassTemplateExtendsTest.php +++ b/tests/Template/ClassTemplateExtendsTest.php @@ -4561,6 +4561,38 @@ class ClassTemplateExtendsTest extends TestCase } }' ], + 'inheritCorrectParams' => [ + '