Hey Tim,

On 2.3.2026 21:45:39, Tim Düsterhus wrote:
Hi

please consider this email as a formal request for comments on my modest proposal of adding a new `enum SortDirection` to PHP’s standard library.

I have made the full proposal available on the World Wide Web at:

https://wiki.php.net/rfc/sort_direction_enum

Yours sincerely
Tim Düsterhus


That's a good idea, but I wouldn't introduce such class without some usages at least.

I'd recommend considering immediately upgrading the proposed functions to use SortDirection and redefine the constants in terms of the enum.

I.e. set const SORT_ASC = SortDirection::Ascending; - similar for others like the SCANDIR_SORT_DESCENDING etc..

This is a reasonable BC break, which is also trivially fixed by simply accepting int|SortDirection in existing functions.


Thanks,
Bob

Reply via email to