1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-11 08:49:52 +01:00

Fix #4549 Better intersection between parent types (#4560)

This commit is contained in:
Thomas Mauro Vargiu 2020-11-16 02:29:49 +01:00 committed by GitHub
parent 5df2b771aa
commit 4e8fb9c37f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -779,11 +779,19 @@ class Methods
if ((!$old_contained_by_new && !$new_contained_by_old)
|| ($old_contained_by_new && $new_contained_by_old)
) {
$attempted_intersection = Type::intersectUnionTypes(
$overridden_storage->return_type,
$candidate_type,
$source_analyzer->getCodebase()
);
if ($old_contained_by_new && $new_contained_by_old) {
$attempted_intersection = Type::intersectUnionTypes(
$candidate_type,
$overridden_storage->return_type,
$source_analyzer->getCodebase()
);
} else {
$attempted_intersection = Type::intersectUnionTypes(
$overridden_storage->return_type,
$candidate_type,
$source_analyzer->getCodebase()
);
}
if ($attempted_intersection) {
$self_class = $overridden_method_id->fq_class_name;