Closed Alkarex closed 1 year ago
I disagree. It returns 0|1|false
, and you should be interested in the difference between 0
and false
.
You can always disable this rule in phpstan-strict-rules, and write your own :)
You can always disable this rule in phpstan-strict-rules, and write your own
That is not answering the question, but then I am guessing that you are not interested in a PR to add a rule to check for "relaxed booleans in conditions". Let me know otherwise.
I am guessing that you are not interested in a PR to add a rule
No, I'm not, I have a different opinion.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Hello, While the
booleansInConditions
rule is nice in many situations, it does not work so elegantly with functions returning near-booleans { 0, 1 }. A salient example ispreg_match()
:Would you have a suggestion to relax
booleansInConditions
to { false, true, 0, 1} with the current code-base? If not, would you welcome a PR to allow this possibility? (And if so, hints welcome)