Allow SortDirection enum in ObjectRepository::findBy() - #525
Merged
Conversation
GromNaN
force-pushed
the
sortdirection-findby-5.0.x
branch
from
September 11, 2026 13:42
e491a08 to
781d59b
Compare
GromNaN
force-pushed
the
sortdirection-findby-5.0.x
branch
from
September 11, 2026 14:12
781d59b to
0c41836
Compare
Widen the PHPDoc contract of findBy() to accept the PHP 8.6 SortDirection enum in addition to the 'asc', 'desc', 'ASC' and 'DESC' string literals. The native signature is unchanged and strings remain accepted. This is a breaking change for implementers of ObjectRepository, who cannot declare a more restrictive type for $orderBy, so the change is done in 5.0 only. Add symfony/polyfill-php86 to require-dev so PHPStan can resolve the SortDirection symbol on PHP 8.4-8.5 without a production dependency. Refs doctrine#523
GromNaN
force-pushed
the
sortdirection-findby-5.0.x
branch
from
September 11, 2026 14:12
0c41836 to
3371eef
Compare
GromNaN
marked this pull request as ready for review
September 11, 2026 14:13
stof
approved these changes
Sep 11, 2026
greg0ire
approved these changes
Sep 11, 2026
This was referenced Sep 11, 2026
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.
Closes #523.
ObjectRepository::findBy()$orderBynow accepts the PHP 8.6SortDirectionenum in addition to the'asc','desc','ASC'and'DESC'strings. The native signature is unchanged and strings remain accepted.This is a breaking change for implementers of
ObjectRepository, who cannot declare a more restrictive type for$orderBy, so it targets 5.0 only. The companion change on 4.3.x (#524) was closed for that reason.symfony/polyfill-php86is added torequire-devso PHPStan can resolveSortDirectionon PHP 8.4-8.5 without a production dependency. The contract is validated by the static-analysis CI.