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

[11.x] prefer new Collection() over collect() #53563

Merged
merged 3 commits into from
Nov 18, 2024

Conversation

browner12
Copy link
Contributor

the collect() helper is a basic wrapper for new Collection(). because there is no logic in the helper, I believe the framework should internally only use new Collection().

I'm guessing the general sentiment will be "it's fine", and I understand the performance hit is miniscule. However, I believe the framework should avoid aliases and no-logic helpers to try and have the shortest and most performant call graph it can.

this also makes DX slightly better when navigating the framework as you don't have a middleman to click through.


There is A LOT of usage of collect() in this repo. I've included a good chunk of them in this PR, but didn't want to commit the time until a decision is made on it, but will do so if it's accepted.

@taylorotwell taylorotwell merged commit b2d6991 into laravel:11.x Nov 18, 2024
31 checks passed
@browner12
Copy link
Contributor Author

great. I'll get to work tonight on replacing the remaining occurrences.

@browner12 browner12 deleted the AB-no-collect branch November 18, 2024 22:04
@joshmanders
Copy link
Contributor

@browner12 doing gods work

@AhmedAlaa4611

This comment was marked as resolved.

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.

4 participants