-
-
Notifications
You must be signed in to change notification settings - Fork 861
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
Return type for json_decode based on second parameter #1874
Comments
Hi, this isn't practical because the return type of |
@ondrejmirtes Yea... I remembered of documentation line
after creating the issue. Return type ends up to be: And it's not easy to determine which one will be there without actually running the code. |
That's too annoying, because it would complain when passing the result somewhere...
|
I agree. :) |
Summary of a problem or a feature request
json_decode
has second parameter to determine if result is anarray
or\stdClass
. It would be nice to catch cases when there's noassoc: true
, and code is trying to access the result ofjson_decode
as an array and vice versa.Code snippet that reproduces the problem
No error for:
https://phpstan.org/r/936624ae-ac3f-4f70-afad-e6480a19a6e6
Expected output
https://3v4l.org/KCXIa
The text was updated successfully, but these errors were encountered: