-
-
Notifications
You must be signed in to change notification settings - Fork 919
mb_str_split false return #4183
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
Comments
I was just about to report the same, and already had the playground prepared :-) I think the problem is coming from phpstan/phpstan-src#379 https://www.php.net/manual/en/function.mb-str-split.php#refsect1-function.mb-str-split-returnvalues says:
|
Turns out |
Phpstan is correctly returning an error, since the value is
Yes, but like
I would say that when If the third parameter is a contant
If the third parameter is a variable, we can't know. It's maybe easier to use a different FunctionReturnType extension for str_split and for mb_str_split. |
We can change the returned type for There's already some extension in PHPStan itself that checks this function (mb_list_encodings), feel free to draw inspiration from that. |
Will try something phpstan/phpstan-src#396 |
Fixed by: phpstan/phpstan-src#396 |
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
mb_str_split
split may returnfalse
on error, but PHPStan no longer thinks so (but it used to not complain about this). For example, on PHP 7.4: https://3v4l.org/9ZQGj.Code snippet that reproduces the problem
https://phpstan.org/r/e5baddbc-759f-426b-aa23-7e0a23cf25a8
Expected output
No issue.
The text was updated successfully, but these errors were encountered: