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
Parameter #2 $array of function array_map expects array, array given. #5872
Comments
But I don't know if this is the expected behaviour. 🤔 |
Well like I said. Whether or not this is a legit issue, it's clearly not being reported in a way that makes sense. |
But you can't cast mixed into |
Actually you can. It has defined behaviour in all cases. object -> array of properties |
But is that the expected behaviour for that method? Maybe something more strict then "mixed" is a good idea 💡 here? |
Another example: https://phpstan.org/r/70dfe8f0-49ca-4c39-8a78-7c0dbf5afb7c
|
@dktapps After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-PHP 8.0 (1 error)
-==========
-
-10: Parameter #2 $array of function array_map expects array, array given.
-
-PHP 7.1 – 7.4 (1 error)
-==========
-
-10: Parameter #2 $input1 of function array_map expects array, array given.
+No errors |
@kubawerlos After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-PHP 8.0 (1 error)
-==========
-
-23: Parameter #2 $array of function array_map expects array, array<int> given.
-
-PHP 7.1 – 7.4 (1 error)
-==========
-
-23: Parameter #2 $input1 of function array_map expects array, array<int> given.
+No errors |
Cool, thank you @ondrejmirtes |
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
Code snippet that reproduces the problem
https://phpstan.org/r/61bbc322-2593-40a7-861a-b6b64c9e70e4
Expected output
No error should be reported.
Even if this is an error for some reason I overlooked,
expects array, array given
isn't giving me any idea what the actual problem is.Did PHPStan help you today? Did it make you happy in any way?
It found a ton of new bugs in my code. Not sure which are real bugs yet though ..
The text was updated successfully, but these errors were encountered: