We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When a closure has an array typehint, PHPStan does not recognize the shape of the array, even if it's able to do so when the typehint is not present.
array
https://phpstan.org/r/38829cd6-d8d5-4603-b07c-5f79335e0ce2
No errors.
The text was updated successfully, but these errors were encountered:
@Agares After the latest commit in dev-master, PHPStan now reports different result with your code snippet:
@@ @@ -PHP 7.4 – 8.0 (1 error) +PHP 7.4 – 8.0 ========== -8: Parameter #1 $x of method HelloWorld::takesShapedArray() expects array(int, string), array given. +No errors PHP 7.1 – 7.3 (4 errors) ==========
No errors
Syntax error, unexpected ',' on line 8
Syntax error, unexpected T_VARIABLE, expecting ':' on line 8
Syntax error, unexpected ',' on line 9
Syntax error, unexpected T_DOUBLE_ARROW, expecting ')' on line 9
Sorry, something went wrong.
Nice, it appears that this now works correctly 💪
Regression tests
5ffa79f
Closes phpstan/phpstan#4902 Closes phpstan/phpstan#3660 Closes phpstan/phpstan#4083 Closes phpstan/phpstan#4681
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.
No branches or pull requests
Bug report
When a closure has an
array
typehint, PHPStan does not recognize the shape of the array, even if it's able to do so when the typehint is not present.Code snippet that reproduces the problem
https://phpstan.org/r/38829cd6-d8d5-4603-b07c-5f79335e0ce2
Expected output
No errors.
The text was updated successfully, but these errors were encountered: