Skip to content

Commit

Permalink
Allow falsable issues on DateInterval::$days
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Jun 17, 2020
1 parent 0a8b9b5 commit 4870774
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Psalm/Internal/Codebase/Reflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,22 @@ 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) {
$property_id = $class_name . '::$' . $property_name;

if (!isset($storage->properties[$property_name])) {
$storage->properties[$property_name] = new PropertyStorage();
$storage->properties[$property_name]->visibility = ClassLikeAnalyzer::VISIBILITY_PUBLIC;

$property_id = $class_name . '::$' . $property_name;

$storage->declaring_property_ids[$property_name] = $class_name;
$storage->appearing_property_ids[$property_name] = $property_id;
$storage->inheritable_property_ids[$property_name] = $property_id;
}

$storage->properties[$property_name]->type = Type::parseString($type);

if ($property_id === 'DateInterval::$days') {
$storage->properties[$property_name]->type->ignore_falsable_issues = true;
}
}

/** @var array<string, int|string|float|null|array> */
Expand Down

0 comments on commit 4870774

Please sign in to comment.