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

Add unshift method to Collection #51344

Merged
merged 1 commit into from
May 8, 2024

Conversation

timkelty
Copy link
Contributor

@timkelty timkelty commented May 8, 2024

It can be disorienting coming from other languages (including vanilla PHP) that Collections don't have an unshift() method. This is the sibling of push().

The closest thing is prepend(), but that specifically prepends one item, and can't be made variadic because it has a second key argument.

This has been brought up before (#36830, #37237), but I think those PRs missed the mark in that they weren't variadic, like push().

@taylorotwell taylorotwell merged commit cbd251f into laravel:11.x May 8, 2024
30 checks passed
@timkelty timkelty deleted the feature/collection-unshift branch May 9, 2024 05:19
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