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
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/130226The 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.
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
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/130226The 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