Skip to content

Commit 4870774

Browse files
committed
Allow falsable issues on DateInterval::$days
1 parent 0a8b9b5 commit 4870774

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Psalm/Internal/Codebase/Reflection.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,22 @@ public function registerClass(\ReflectionClass $reflected_class)
130130

131131
// have to do this separately as there can be new properties here
132132
foreach ($public_mapped_properties as $property_name => $type) {
133+
$property_id = $class_name . '::$' . $property_name;
134+
133135
if (!isset($storage->properties[$property_name])) {
134136
$storage->properties[$property_name] = new PropertyStorage();
135137
$storage->properties[$property_name]->visibility = ClassLikeAnalyzer::VISIBILITY_PUBLIC;
136138

137-
$property_id = $class_name . '::$' . $property_name;
138-
139139
$storage->declaring_property_ids[$property_name] = $class_name;
140140
$storage->appearing_property_ids[$property_name] = $property_id;
141141
$storage->inheritable_property_ids[$property_name] = $property_id;
142142
}
143143

144144
$storage->properties[$property_name]->type = Type::parseString($type);
145+
146+
if ($property_id === 'DateInterval::$days') {
147+
$storage->properties[$property_name]->type->ignore_falsable_issues = true;
148+
}
145149
}
146150

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

0 commit comments

Comments
 (0)