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
https://phpstan.org/r/51b169ed-dff3-477d-a0c8-f6f2f9bcdd93
function test(array $array): string { if (!$array) { throw new \Exception('empty'); } $shift = array_shift($array); // <- this is problem because of reference return $array ? 'has' : 'empty'; // <- error } var_dump(test(['first', 'second'])); var_dump(test(['first']));
Output is string(3) "has" string(5) "empty"
string(3) "has" string(5) "empty"
Phpstan outputs " 9 | Ternary operator condition is always true."
The text was updated successfully, but these errors were encountered:
Will be fixed by #1964 once we figure out how to correctly change the typesystem.
Sorry, something went wrong.
Fixed: e937b16
No branches or pull requests
https://phpstan.org/r/51b169ed-dff3-477d-a0c8-f6f2f9bcdd93
Code snippet that reproduces the problem
Output is
string(3) "has" string(5) "empty"
Phpstan outputs " 9 | Ternary operator condition is always true."
The text was updated successfully, but these errors were encountered: