Skip to content

[12.x] Use PHP 8.4 array helpers #56619

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

Merged
merged 4 commits into from
Aug 11, 2025

Conversation

jnoordsij
Copy link
Contributor

@jnoordsij jnoordsij commented Aug 11, 2025

PHP 8.4 introduces new array search functions for finding items matching criteria or determining if any/all of them pass. See also https://php.watch/versions/8.4/array_find-array_find_key-array_any-array_all.

This PR introduces these helpers in the Arr and Collection classes to use modern and simplified logic. By requiring the Symfony polyfills for lower PHP versions, this should be backwards compatible.

This is effectively #53426 re-opened, but with polyfills to allow for actual code simplification. These polyfills can also be easily recognized and removed upon requiring a higher PHP minimal version in the future.

@shaedrich
Copy link
Contributor

Also, #56526 can be simplified

@taylorotwell taylorotwell merged commit 087ce3a into laravel:12.x Aug 11, 2025
60 checks passed
@jnoordsij jnoordsij deleted the use-php-array-helpers branch August 11, 2025 14:49
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.

3 participants