Skip to content

[14.x] Remove default order fallback for collection sorting#59989

Closed
jnoordsij wants to merge 2 commits into
laravel:masterfrom
jnoordsij:remove-default-order-fallback
Closed

[14.x] Remove default order fallback for collection sorting#59989
jnoordsij wants to merge 2 commits into
laravel:masterfrom
jnoordsij:remove-default-order-fallback

Conversation

@jnoordsij

@jnoordsij jnoordsij commented May 4, 2026

Copy link
Copy Markdown
Contributor

Working on #59859, I discovered a weird lax matching of sort directions in the (internal) sortByMany method on collections, that aims to results in ascending sort order whenever 'asc' or true was passed, and descending order for any other value. Given that other values might not make sense (e.g. the ['string', 'string'] example refactored in #59988 seems weird?) or may even aim to achieve the opposite (e.g. one tries to pass ['string', 'ASC'] or ['string', true] expecting the latter to mean descending: true like in practically all other locations), I propose to remove this functionality entirely.

The stricter docblocks introduced in #59988 should comply with the new allowed signatures, to allow people to spot this already when running static analysis on 13.x.

Note: this contains a cherry-pick from 13.x and is thus not ready for merge until master receives a downstream merge from 13.x first.

It also drops a test introduced in #59859 to test fallback logic, for this syntax that was never formally supported or documented.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@crynobone crynobone added the needs work Not quite ready for primetime label May 12, 2026
@jnoordsij
jnoordsij force-pushed the remove-default-order-fallback branch from 6f74eb6 to b4fa029 Compare June 4, 2026 15:16
@jnoordsij
jnoordsij marked this pull request as ready for review June 4, 2026 15:17
jnoordsij added 2 commits June 4, 2026 17:27
Although previously functional, this was never documentend, and just introduced in laravel#59859 to verify consistent behavior
@jnoordsij
jnoordsij force-pushed the remove-default-order-fallback branch from b4fa029 to 325fad8 Compare June 4, 2026 15:27
@taylorotwell

Copy link
Copy Markdown
Member

Eh, I'm not sure it's worth the breaking change.

@jnoordsij
jnoordsij deleted the remove-default-order-fallback branch June 5, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs work Not quite ready for primetime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants