-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modulo '1' is always zero #973
Conversation
$rightType->getValue() === 0 | ||
|| $rightType->getValue() === 0.0 | ||
$scalarType->getValue() === 0 | ||
|| $scalarType->getValue() === 0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about '0'
here? Again, you can try ->toInteger()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code was existant before this PR and covers a different use-case.
should I change it with this PR nevertheless , or better do so in a different PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do it here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newly added testcases in 578e96d show that division by '0' and other falsy values work as expected.
so IMO we just leave this as is, right?
Thank you. |
closes phpstan/phpstan#5822