Skip to content

Missing method ajustments after « Doctrine\Common\Collections\Order » enum deprecation #526

Description

@PapsOu

Hello,

Since this commit doctrine/collections@7f964ae the deprecation of Order enum encourage usage of native php 8.6 (not released at this time) SortDirection enum.

But methods that uses ordering are not updated regarding the usage of that enum:

ObjectRepository::findBy (https://github.com/doctrine/persistence/blob/4.2.x/src/ObjectRepository.php), argument $orderBy only accept strings 'asc'|'desc'|'ASC'|'DESC' and the SortDirection enum does not expose those values (e.g. with SortDirection::Ascending->name)

So phpstan triggers deprecations about a feature that is not released yet and other methods are not ready for that new feature.

I must ignore those errors in our Quality stack for the moment and replace usages of Order enum with string representations (it sounds like a little regression).

Regards.

(may be moving this issue to https://github.com/doctrine/persistence/issues instead ?)

Activity

  1. PapsOu commented on Sep 18, 2026

    @PapsOu
    Author

    Ok, related to this open PR : doctrine/orm#12613

  2. stof commented on Sep 18, 2026

    @stof
    Member

    Since this commit doctrine/collections@7f964ae the deprecation of Order enum encourage usage of native php 8.6 (not released at this time) SortDirection enum.

    that enum is from PHP 8.4+, not the unreleased PHP 8.6

  3. PapsOu commented on Sep 18, 2026

    @PapsOu
    Author

    @stof you mean the polyfill enum ? I see here (https://php.watch/versions/8.6/SortDirection) that the real native enum will be released with php 8.6.

  4. stof commented on Sep 21, 2026

    @stof
    Member

    ah sorry, I messed up things

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions