From d0d7c46d26e618dc13510f888fe46bddeb4be323 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 26 Nov 2022 17:37:48 +0100 Subject: [PATCH] Fix --- .../Internal/Type/Comparator/ArrayTypeComparator.php | 7 +++++-- .../Internal/Type/Comparator/KeyedArrayComparator.php | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php b/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php index 1276c8119..4cf3b87dd 100644 --- a/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php @@ -80,9 +80,12 @@ class ArrayTypeComparator } if ($container_type_part instanceof TKeyedArray - && $input_type_part instanceof TKeyedArray && $container_type_part->is_list - && !$input_type_part->is_list + && ( + ($input_type_part instanceof TKeyedArray + && !$input_type_part->is_list) + || $input_type_part instanceof TArray + ) ) { return false; } diff --git a/src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php b/src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php index f3f86ead9..df4c1160c 100644 --- a/src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php +++ b/src/Psalm/Internal/Type/Comparator/KeyedArrayComparator.php @@ -38,6 +38,14 @@ class KeyedArrayComparator return false; } + if ($container_type_part instanceof TKeyedArray + && $container_type_part->is_list + && $input_type_part instanceof TKeyedArray + && !$input_type_part->is_list + ) { + return false; + } + $all_types_contain = true; $input_properties = $input_type_part->properties;