Skip to content

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

Draft
jnoordsij wants to merge 2 commits intolaravel:masterfrom
jnoordsij:remove-default-order-fallback
Draft

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

Conversation

@jnoordsij
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.

jnoordsij and others added 2 commits May 4, 2026 15:39
…ns and Arr (laravel#59859)

* Add PHP 8.6 polyfill to Collection

* Update Collection methods to support SortDirection enum

* Update Arr methods to support SortDirection enum
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

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.

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.

1 participant