From b5b96c06a627725fd8bf677ebfb46005ca66c61b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Tue, 12 Nov 2024 01:20:24 +0100 Subject: [PATCH] Fix object properties lose type --- src/Psalm/Type/Reconciler.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Psalm/Type/Reconciler.php b/src/Psalm/Type/Reconciler.php index b520ab9d52f..0daddae5659 100644 --- a/src/Psalm/Type/Reconciler.php +++ b/src/Psalm/Type/Reconciler.php @@ -54,6 +54,7 @@ use Psalm\Type\Atomic\TNever; use Psalm\Type\Atomic\TNull; use Psalm\Type\Atomic\TObject; +use Psalm\Type\Atomic\TObjectWithProperties; use Psalm\Type\Atomic\TString; use Psalm\Type\Atomic\TTemplateParam; use ReflectionProperty; @@ -845,6 +846,9 @@ private static function getValueForKey( if ($existing_key_type_part instanceof TNull) { $class_property_type = Type::getNull(); + } elseif ($existing_key_type_part instanceof TObjectWithProperties) { + $class_property_type = + $existing_key_type_part->properties[$property_name] ?? Type::getMixed(); } elseif ($existing_key_type_part instanceof TMixed || $existing_key_type_part instanceof TObject || ($existing_key_type_part instanceof TNamedObject