-
Notifications
You must be signed in to change notification settings - Fork 660
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
Internal: non-strict checking leads to inconsistent behavior #10501
Comments
I found these snippets: https://psalm.dev/r/30076adf91<?php
/**
* @param array|null $arg
* @return void
*/
function foo($arg) {
if ($arg) {
// this is risky, bc the empty array and null case are handled together
}
if (!$arg) {
// this is risky, bc the empty array and null case are handled together
}
}
|
Will create a PR for this |
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Dec 18, 2023
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Jan 12, 2024
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Jan 12, 2024
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Jan 13, 2024
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Jan 13, 2024
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Jan 13, 2024
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Jan 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://psalm.dev/r/30076adf91
There are phpcs rules that disallow this already, however it might be too intrusive, bc it will disallow this in all cases, instead of only when necessary (e.g.
Squiz.Operators.ComparisonOperatorUsage.ImplicitFalse
andSquiz.Operators.ComparisonOperatorUsage.ImplicitTrue
orSquiz.Operators.ComparisonOperatorUsage
)There should be a psalm check for these, where a union of falsy types is flagged.
This is an internal issue (e.g. #10500 was only necessary bc of the non-strict checking) but I probably also affects psalm users's codebases.
The text was updated successfully, but these errors were encountered: