# [VOTE] enum SortDirection

- Thread: https://externals.io/message/130395
- Original archive: https://news-web.php.net/php.internals/130395
- Started by tim@bastelstu.be on 2026-03-18T15:50:12+00:00
- Messages: 4
- RFC: enum SortDirection (Implemented (PHP 8.6)) — https://externals.io/rfc/sort_direction_enum.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #130395 — tim@bastelstu.be — 2026-03-18T15:50:12+00:00

URL: https://externals.io/message/130395#130395

Hi

I just opened voting on the “enum SortDirection” RFC.

The RFC document is available at: 
https://wiki.php.net/rfc/sort_direction_enum
You can find the Discussion at: 
https://news-web.php.net/php.internals/130226

The RFC contains a single primary vote requiring a 2/3 majority. Voting 
closes in just over 14 days on 2026-04-01 16:00:00 UTC.

Best regards
Tim Düsterhus

---

## #130396 — Levi Morrison — 2026-03-18T18:38:10+00:00

URL: https://externals.io/message/130395#130396 · In reply to: #130395

>
> Hi
>
> I just opened voting on the “enum SortDirection” RFC.
>
> The RFC document is available at:
> https://wiki.php.net/rfc/sort_direction_enum
> You can find the Discussion at:
> https://news-web.php.net/php.internals/130226
>
> The RFC contains a single primary vote requiring a 2/3 majority. Voting
> closes in just over 14 days on 2026-04-01 16:00:00 UTC.
>
> Best regards
> Tim Düsterhus

Tim, I am curious if adding a backing value in a future release would
be considered a breaking change or not, something like:

enum SortDirection {
    case Ascending = 1;
    case Descending = -1;
}

The exact values don't matter for my question, only whether or not it
would be considered a backwards compatibility break.

---

## #130397 — tim@bastelstu.be — 2026-03-18T20:32:56+00:00

URL: https://externals.io/message/130395#130397 · In reply to: #130396

Hi


> Tim, I am curious if adding a backing value in a future release would
> be considered a breaking change or not, something like:
> 
> enum SortDirection {
>      case Ascending = 1;
>      case Descending = -1;
> }
> 
> The exact values don't matter for my question, only whether or not it
> would be considered a backwards compatibility break.

That's complicated to answer. From a LSP POV changing a UnitEnum to a 
BackedEnum is just “adding new things” (and indeed the BackendEnum 
interface extends UnitEnum), which is safe from a backwards 
compatibility PoV. However I've seen folks doing `instanceof` checks in 
the folks to decide whether to use the ->name or ->value for 
serialization. Changing from UnitEnum to BackedEnum would introduce a 
behavioral change there.

All that said, I believe making an enum backed is almost always a 
mistake, since there is rarely a single obvious "blessed" scalar 
representation of an enum value, doubly so for the featured enum of this 
RFC, as explained by the RFC. See also the first paragraph of this email 
from me in another discussion thread: 
https://news-web.php.net/php.internals/129408

Best regards
Tim Düsterhus

---

## #130527 — tim@bastelstu.be — 2026-04-01T17:34:58+00:00

URL: https://externals.io/message/130395#130527 · In reply to: #130395

Hi

Am 2026-03-18 16:50, schrieb Tim Düsterhus:
> I just opened voting on the “enum SortDirection” RFC.
> 
> The RFC document is available at: 
> https://wiki.php.net/rfc/sort_direction_enum
> You can find the Discussion at: 
> https://news-web.php.net/php.internals/130226
> 
> The RFC contains a single primary vote requiring a 2/3 majority. Voting 
> closes in just over 14 days on 2026-04-01 16:00:00 UTC.

The RFC has been accepted with 22 Yes to 2 No votes (92%) and 2 
Abstentions.

Best regards
Tim Düsterhus
