From bccda92f31ae26cbcb660fc3b57f08016812ece2 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 18 Dec 2022 17:11:53 +0100 Subject: [PATCH] Skip intersection of template types during inheritance check --- src/Psalm/Internal/Codebase/Methods.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/Codebase/Methods.php b/src/Psalm/Internal/Codebase/Methods.php index 940edc9c4..459f8496e 100644 --- a/src/Psalm/Internal/Codebase/Methods.php +++ b/src/Psalm/Internal/Codebase/Methods.php @@ -768,8 +768,10 @@ class Methods $candidate_type ); - if ((!$old_contained_by_new && !$new_contained_by_old) - || ($old_contained_by_new && $new_contained_by_old) + if (((!$old_contained_by_new && !$new_contained_by_old) + || ($old_contained_by_new && $new_contained_by_old)) + && !$candidate_type->hasTemplate() + && !$overridden_storage->return_type->hasTemplate() ) { $attempted_intersection = null; if ($old_contained_by_new) { //implicitly $new_contained_by_old as well