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
Method [...] should return array but returns array #5861
Comments
This bug report is missing a link to reproduction on phpstan.org. It will most likely be closed after manual review. |
Just added it |
Seems like this might be something to do with the This sample works as expected: https://phpstan.org/r/655f3f3d-dde4-44fc-9558-18bce188ca16 |
@acelaya After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-4: Method Foo::parse() return type has no value type specified in iterable type array.
-6: Method Foo::parse() should return array but returns array.
+4: Method Foo::parse() return type has no value type specified in iterable type array. Full report
|
|
Closes phpstan/phpstan#5834 Closes phpstan/phpstan#5881 Closes phpstan/phpstan#5872 Closes phpstan/phpstan#5861
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
I have just updated to PHPStan 1.0, and wanted to try the new level 9 on a small library.
I have a method set to return
array
, which basically wraps a call tojson_decode
. On first execution it threwMethod [...] should return array but returns mixed
, so I added a casting to array to explicitly comply with the type (even though the second param,associative
, is true in my implementation).After running phpstan again, then it throws
Method [...] should return array but returns array
.Code snippet that reproduces the problem
Link reproducing it: https://phpstan.org/r/b82ca237-abc3-48ed-83a2-7d64551ea493
Expected output
PHPStan should not complain about that.
Did PHPStan help you today? Did it make you happy in any way?
PHPStan is just amazing, I have been using it for years (almost since it was first released).
It has added so much value to so many projects I have worked on, that I cannot express with words how greatful I am.
This is just a small bug that one would expect on a major release like this one.
Congratulations on the project, and keep up the good work.
The text was updated successfully, but these errors were encountered: