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

uncaught TypeError when calling array_map with null callback and non-empty array #8806

Closed
frontenac opened this issue Dec 1, 2022 · 0 comments

Comments

@frontenac
Copy link

frontenac commented Dec 1, 2022

The following works in 4.30 but throws a TypeError in 5.0

array_map(null, [1]);

https://psalm.dev/r/fd479a295e

Internal Psalm error on line 101 - /vendor/vimeo/psalm/src/Psalm/Internal/Provider/ReturnTypeProvider/ArrayMapReturnTypeProvider.php: Psalm\Internal\Provider\ReturnTypeProvider\ArrayMapReturnTypeProvider::Psalm\Internal\Provider\ReturnTypeProvider\{closure}(): Argument #1 ($sub) must be of type array, Psalm\Type\Union given

array_map(null, []); runs without exception.

@frontenac frontenac changed the title uncaught TypeError when calling array_map will null callback and non-empty array uncaught TypeError when calling array_map with null callback and non-empty array Dec 1, 2022
@orklah orklah closed this as completed in 3150ad2 Dec 1, 2022
orklah added a commit that referenced this issue Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant