-
-
Notifications
You must be signed in to change notification settings - Fork 934
Closed
phpstan/phpstan-src
#1267Labels
Milestone
Description
Bug report
Both DateTime::modify & DateTimeImmutable::modify can return false, but got following message when testing result :
Strict comparison using === between DateTimeImmutable and false will always evaluate to false.
Strict comparison using === between DateTime and false will always evaluate to false.
I found #1934 which is about almost the same thing, but somehow the issue get closed.
Code snippet that reproduces the problem
https://phpstan.org/r/3b587421-aa5b-4c3f-ac48-7b5c20e1d61c
Expected output
These 2 methods should consider that the return type is potentially false, as documented here :
DateTime::modify: https://www.php.net/manual/en/datetime.modify.php#refsect1-datetime.modify-returnvaluesDateTimeImmutable::modify: https://www.php.net/manual/en/datetimeimmutable.modify.php#refsect1-datetimeimmutable.modify-returnvalues
pbourdet