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

Replace the array_merge with spread array operator #996

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

peter279k
Copy link
Contributor

Changed log

  • According to the reference, it's great to use the spread array operator to replace the array_merge function.
  • There're two reasons about using the spread array operator:
    • Spread operator should have a better performance than array_merge and compile time optimization can be performant for constant arrays.
    • array_merge only supports array, while the spread operator also supports objects implementing Traversable.

Copy link
Member

@colinodell colinodell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@colinodell colinodell merged commit 7af3307 into thephpleague:2.4 Oct 9, 2023
14 checks passed
@peter279k peter279k deleted the optimize_array_merge branch October 10, 2023 05:24
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.

None yet

2 participants