Skip to content

array_map doesn't infer an array type #5292

Discussion options

You must be logged in to vote

Hi, this is expected since we don' know how the arrow function in $rowToString will be used.

If you move the declaration directly into the array_map call it works as you want it to: https://phpstan.org/r/4a331a70-2f73-4396-9f14-71fc0f2ac2e9 (I also had to modify the $data PHPDoc as the arrays weren' exactly the same)

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@BenoitDuffez
Comment options

@ondrejmirtes
Comment options

@BenoitDuffez
Comment options

Answer selected by BenoitDuffez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Support
Labels
None yet
2 participants