Skip to content

Commit

Permalink
Fix object properties lose type
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonE committed Nov 12, 2024
1 parent 23b00f5 commit b5b96c0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Psalm/Type/Reconciler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b5b96c0

Please sign in to comment.