We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I have such example in a code:
$missingArgs = []; $args = ['username' => 'name', 'password' => 'password']; $username = $args['username'] ?? $missingArgs[] = 'username'; $password = $args['password'] ?? $missingArgs[] = 'password'; if ($missingArgs) { //do something }
Phpstan says that: If condition is always true.
https://phpstan.org/r/22616127-39a8-4bbd-874e-1bff9276da26 https://phpstan.org/r/11cebae9-023c-4ea4-bca4-69a03f1e2e50 (https://3v4l.org/Hkrk5)
If condition is not always true
Could/should it be fixed in phpstan?
The text was updated successfully, but these errors were encountered:
Hi, please check your code. The condition is really always true: https://3v4l.org/Sr5Xk
Sorry, something went wrong.
Sorry, updated with false - https://phpstan.org/r/11cebae9-023c-4ea4-bca4-69a03f1e2e50 (https://3v4l.org/Hkrk5)
I see the problem now, thanks.
I'm running into this issue as well when doing an isset on an object with ArrayAccess: https://phpstan.org/r/60cebe59-957e-42fe-bbb0-e6b4961c1213 (https://3v4l.org/ZQo4i)
Fixed:
No branches or pull requests
Bug report
Hi, I have such example in a code:
Phpstan says that: If condition is always true.
Code snippet that reproduces the problem
https://phpstan.org/r/22616127-39a8-4bbd-874e-1bff9276da26
https://phpstan.org/r/11cebae9-023c-4ea4-bca4-69a03f1e2e50 (https://3v4l.org/Hkrk5)
Expected output
If condition is not always true
Could/should it be fixed in phpstan?
The text was updated successfully, but these errors were encountered: