Skip to content

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.

browner12 added a commit to browner12/framework that referenced this pull request Mar 17, 2025
taylorotwell added a commit that referenced this pull request Mar 18, 2025
this is a continuation of #53563

Co-authored-by: Taylor Otwell <taylor@laravel.com>
@AJenbo
Copy link
Contributor

AJenbo commented Mar 19, 2025

Also code analyzers can better reason about empty new Collection() then collect(), so thank you.

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.

5 participants