Skip to content

✨ Full support for iterables for iterator_to_array#11430

Merged
danog merged 1 commit intovimeo:6.xfrom
andrew-demb:full-support-iterable-to-iterable-to-array
Jul 4, 2025
Merged

✨ Full support for iterables for iterator_to_array#11430
danog merged 1 commit intovimeo:6.xfrom
andrew-demb:full-support-iterable-to-iterable-to-array

Conversation

@andrew-demb
Copy link
Contributor

Fixes #11007, #8824

@andrew-demb
Copy link
Contributor Author

Psalm check fails locally with ImpureFunctionCall - this is unrelated to the PR

ERROR: ImpureFunctionCall
at /home/lalshe/php/github/psalm/src/Psalm/Type/Atomic.php:452:24
Cannot call an impure function from a mutation-free context (see https://psalm.dev/202)
                    || array_any(


ERROR: ImpureFunctionCall
at /home/lalshe/php/github/psalm/src/Psalm/Type/Atomic.php:540:24
Cannot call an impure function from a mutation-free context (see https://psalm.dev/202)
                    && array_any(


ERROR: ImpureFunctionCall
at /home/lalshe/php/github/psalm/src/Psalm/Type/Atomic.php:563:24
Cannot call an impure function from a mutation-free context (see https://psalm.dev/202)
                    && array_any(


ERROR: ImpureFunctionCall
at /home/lalshe/php/github/psalm/src/Psalm/Type/Atomic.php:601:24
Cannot call an impure function from a mutation-free context (see https://psalm.dev/202)
                    && array_any(


------------------------------
4 errors found
------------------------------
1639 other issues found.
You can display them with --show-info=true
------------------------------
Psalm can automatically fix 9 of these issues.
Run Psalm again with 
--alter --issues=UnusedVariable,InvalidReturnType,MissingParamType,PossiblyUnusedMethod --dry-run
to see what it can fix.
------------------------------

Checks took 11.55 seconds and used 548.231MB of memory
Psalm was able to infer types for 99.9062% of the codebase
Script @php ./psalm handling the psalm event returned with error code 2

@andrew-demb
Copy link
Contributor Author

My fixes may not cover all possible use-cases - changed with xdebug according to my intuition :)

Please guide me in case of needed improvements

@danog danog added the release:feature The PR will be included in 'Features' section of the release notes label May 12, 2025
@andrew-demb
Copy link
Contributor Author

CI fails for "test-with-real-projects" (phpunit) with most of the errors MissingOverrideAttribute

Should we patch the Psalm configuration in the used PHPUnit fork to disable the "ensure override" feature to match PHPUnit's codestyle?
https://github.com/psalm/endtoend-test-phpunit/blob/2167c36efe537f9492945a8b2f6eb6a94ea2340b/.psalm/static-analysis.xml#L8

@andrew-demb
Copy link
Contributor Author

@danog can I help to proceed the PR?

@danog
Copy link
Collaborator

danog commented Jul 4, 2025

Looks good, thank you!

@danog danog merged commit 73a0687 into vimeo:6.x Jul 4, 2025
50 of 52 checks passed
@andrew-demb andrew-demb deleted the full-support-iterable-to-iterable-to-array branch July 4, 2025 15:26
@ro0NL
Copy link
Contributor

ro0NL commented Jul 17, 2025

related to #11509 #11513?

@ro0NL
Copy link
Contributor

ro0NL commented Jul 18, 2025

cc @andrew-demb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:feature The PR will be included in 'Features' section of the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Converting iterable to array with iterator_to_array causes error

3 participants