[14.x] Remove default order fallback for collection sorting#59989
Draft
jnoordsij wants to merge 2 commits intolaravel:masterfrom
Draft
[14.x] Remove default order fallback for collection sorting#59989jnoordsij wants to merge 2 commits intolaravel:masterfrom
jnoordsij wants to merge 2 commits intolaravel:masterfrom
Conversation
…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
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Working on #59859, I discovered a weird lax matching of sort directions in the (internal)
sortByManymethod on collections, that aims to results in ascending sort order whenever'asc'ortruewas 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 meandescending: truelike 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
masterreceives a downstream merge from13.xfirst.