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

Fix iterator_to_array return type with generators #3652

Merged

Conversation

paulbalandan
Copy link
Contributor

Generators allow any type for its keys. When passed to iterator_to_array(), the keys are coerced to string or int where possible. For non-scalar keys, the function throws.

Current PHPStan behaviour: https://phpstan.org/r/2489fc17-69f8-4e75-894a-48e9cb1b211f
Expected behaviours:

@paulbalandan paulbalandan force-pushed the iterator-to-array-generators branch from 5e0a2a6 to d77b63f Compare November 29, 2024 17:15
@ondrejmirtes ondrejmirtes merged commit 25d712e into phpstan:1.12.x Nov 30, 2024
452 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants