From 7fc1f50f54bd6b174b1c43a37c1b0b151915d55c Mon Sep 17 00:00:00 2001 From: Brown Date: Wed, 17 Jun 2020 16:40:35 -0400 Subject: [PATCH] Fix potential nullref --- src/Psalm/Internal/Codebase/Reflection.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Psalm/Internal/Codebase/Reflection.php b/src/Psalm/Internal/Codebase/Reflection.php index 2aeeec4a278..b174c5626c2 100644 --- a/src/Psalm/Internal/Codebase/Reflection.php +++ b/src/Psalm/Internal/Codebase/Reflection.php @@ -129,7 +129,7 @@ public function registerClass(\ReflectionClass $reflected_class) } // have to do this separately as there can be new properties here - foreach ($public_mapped_properties as $property_name => $type) { + foreach ($public_mapped_properties as $property_name => $type_string) { $property_id = $class_name . '::$' . $property_name; if (!isset($storage->properties[$property_name])) { @@ -141,11 +141,13 @@ public function registerClass(\ReflectionClass $reflected_class) $storage->inheritable_property_ids[$property_name] = $property_id; } - $storage->properties[$property_name]->type = Type::parseString($type); + $type = Type::parseString($type_string); if ($property_id === 'DateInterval::$days') { - $storage->properties[$property_name]->type->ignore_falsable_issues = true; + $type->ignore_falsable_issues = true; } + + $storage->properties[$property_name]->type = $type; } /** @var array */