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] groupBy() return type phpdoc #53684

Merged
merged 1 commit into from
Nov 27, 2024
Merged

Conversation

lorenzolosa
Copy link
Contributor

In the current phpdoc, the return type of Collection::groupBy() is assumed to be a collection with the same values as the original one. However, when the grouping is specified with an array of two or more keys (e.g., $collection->groupBy(['key1', 'key2'])), the result is a multi-level collection (i.e., a collection of collections).

This PR changes the return type so that it doesn't make assumptions on the collection values when the grouping is specified with an array - while leaving it as it is when it's a single key or a function.

If this PR is merged, I'll make a corresponding PR to larastan, as it contains stubs for these classes/interfaces.

@taylorotwell taylorotwell merged commit b1f07ed into laravel:11.x Nov 27, 2024
40 checks passed
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