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
Explode returns false - false positive on < PHP 8 #4711
Comments
There's currently no non-empty-string type in the typesystem, it's still an ordinary string after the condition: https://phpstan.org/r/e9ec2551-a6a0-4b24-ad3a-75c98fe4da6d I plan to implement it, see #3981 for details. |
I was looking for something similar to |
Implemented by: phpstan/phpstan-src@6ef5e91 |
Sorry if I am hijacking this issue, but now on PHP 8 another false positive with explode and |
@tectiv3 Please create a separate issue, this one is unrelated. |
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. |
Bug report
explode()
will returnfalse
if delimiter is empty string.Making sure that the delimiter is not empty does not narrow the return type to array though.
https://phpstan.org/r/c1c8aa4a-cb73-4d9b-93bf-a28b1883cd8d
I would expect no errors on PHP 7.4.
The text was updated successfully, but these errors were encountered: