From 9fd590685cd8266a21e7a604163565763148afc4 Mon Sep 17 00:00:00 2001 From: kkmuffme <11071985+kkmuffme@users.noreply.github.com> Date: Thu, 6 Jul 2023 08:20:46 +0200 Subject: [PATCH] fix "days" ignore falsable return not ignored correctly see Reflection.php, where the same condition was used already, but was insufficient --- .../PhpVisitor/Reflector/ClassLikeNodeScanner.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php index 2bc9d7180cf..fae0c8daf26 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/ClassLikeNodeScanner.php @@ -839,10 +839,15 @@ public function finish(PhpParser\Node\Stmt\ClassLike $node): ClassLikeStorage $classlike_storage->properties[$property_name] = new PropertyStorage(); } - $classlike_storage->properties[$property_name]->type = $property_type; - $property_id = $fq_classlike_name . '::$' . $property_name; + if ($property_id === 'DateInterval::$days') { + /** @psalm-suppress InaccessibleProperty We just parsed this type */ + $property_type->ignore_falsable_issues = true; + } + + $classlike_storage->properties[$property_name]->type = $property_type; + $classlike_storage->declaring_property_ids[$property_name] = $fq_classlike_name; $classlike_storage->appearing_property_ids[$property_name] = $property_id; }