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

[9.x] Adds Arr::map and Arr::transform #42398

Merged
merged 2 commits into from
May 16, 2022
Merged

Conversation

ecrmnn
Copy link
Contributor

@ecrmnn ecrmnn commented May 16, 2022

Adds Arr::map and Arr::transform.

I've finally created a PR for this after assuming it's there for a while.
Everytime I realize it's not, I'm wrapping my array in a collection to get that sweet syntactic sugar 🍬

  • Significantly better syntax than array_map
  • Iterates both values and keys out of the box
  • Consistent API with Collection
  • Refactored Collection to consume Arr::map

Added Arr::transform because they're basically the same, except $array is passed by reference.

@ecrmnn ecrmnn marked this pull request as ready for review May 16, 2022 13:29
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