-
-
Notifications
You must be signed in to change notification settings - Fork 946
Description
Bug report
If a comparison of NULL and objects of type \DateTime are made, I'd expect phpstan to understand that NULL is always lower. (And the object always greater) This is somewhat backed by the official documentation, albeit it not being about objects of type \DateTime specifically.
phpstan seems to understand this regarding scalars, otherwise this case wouldn't succeed either.
I know that it might be difficult for phpstan to decide this, as some objects (like \DateTime) can overload comparisons, but for me this is only about the handling of NULL. And there I hope we can all agree that in this case, phpstan should at least assume the default: object > NULL
Code snippet that reproduces the problem
https://phpstan.org/r/89b39e72-a860-40ed-94df-3aa471982887
Expected output
No errors!
Did PHPStan help you today? Did it make you happy in any way?
Not today, but a few weeks ago it detected a bug that meant a serious security vulnerability which was unnoticed until then.