Skip to content

Commit

Permalink
Fix potential nullref
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Jun 17, 2020
1 parent 4870774 commit 7fc1f50
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Psalm/Internal/Codebase/Reflection.php
Expand Up @@ -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])) {
Expand All @@ -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<string, int|string|float|null|array> */
Expand Down

0 comments on commit 7fc1f50

Please sign in to comment.