Skip to content
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 $callback of function array_map expects (callable(mixed): mixed)) #12317

Open
psprokofiev opened this issue Dec 23, 2024 · 2 comments · May be fixed by phpstan/phpstan-src#3763
Open
Labels
Milestone

Comments

@psprokofiev
Copy link

Bug report

Array Map requires mixed as a callable argument

Code snippet that reproduces the problem

https://phpstan.org/r/31bce9df-d1d8-4647-a763-fd6535709243

Expected output

PHPStan shouldn't detect any issue

Did PHPStan help you today? Did it make you happy in any way?

No response

@ondrejmirtes
Copy link
Member

This is because of named arguments. This places is wrong and doesn't account for them: https://github.com/phpstan/phpstan-src/blob/aa4a1232d2fbd6460632cb55d337e18539757281/src/Parser/ArrayMapArgVisitor.php#L17-L28

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Dec 23, 2024
@staabm
Copy link
Contributor

staabm commented Dec 24, 2024

Please re-open. Its a valid bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants