From b8ffb3163c15f04b95051e4a0cd8505f8b5e375b Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 2 Dec 2022 13:36:05 +0100 Subject: [PATCH] Possible fix --- src/Psalm/Internal/Type/TypeCombiner.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Psalm/Internal/Type/TypeCombiner.php b/src/Psalm/Internal/Type/TypeCombiner.php index 9d6441078..579000259 100644 --- a/src/Psalm/Internal/Type/TypeCombiner.php +++ b/src/Psalm/Internal/Type/TypeCombiner.php @@ -667,6 +667,12 @@ class TypeCombiner $codebase, $overwrite_empty_array ); + if ((!$value_type->possibly_undefined || !$candidate_property_type->possibly_undefined) + && $overwrite_empty_array + ) { + $combination->objectlike_entries[$candidate_property_name] = + $combination->objectlike_entries[$candidate_property_name]->setPossiblyUndefined(false); + } } if (!$candidate_property_type->possibly_undefined) {