Hi
On 3/3/26 01:36, Larry Garfield wrote:
> I concur. I'd like to see the functions updated now in the RFC, so we get a sense of how many functions will be impacted. Not because I'm concerned about a widened type breaking anything, but more so readers can see the value this brings.
I see the main value in helping userland not to reinvent the wheel every
time and to set some further precedent in including types for this kind
of ubiquitous concept in the standard library.
I don't want to commit to supporting the enum for every possible
function in the standard library for the reasons I mentioned in my reply
to Bob and also because some of the functions already have a very messy
API signature where backfitting the enum is not exactly trivial.
> Nit: Should we use Asc and Desc, for more compact code?
I considered using the abbreviations, but then intentionally decided for
the full names. Our naming policy
(https://github.com/php/policies/blob/main/coding-standards-and-naming.rst#acronyms)
states:
> Abbreviations and acronyms as well as initialisms SHOULD be avoided wherever possible.
I don't believe that this enum is a case where it is warranted to
diverge from the SHOULD. My rule of thumb here is that for an
abbreviation to be acceptable, it must be the “more common form” of the
term in question.
As an example: I would say “I am sorting the list in descending order by
name” or something like that. However when I am talking about the
protocol that is commonly using TCP port 80 I would say “I am sending a
HTTP request”, not “I am sending a request using the hypertext transfer
protocol”. HTTP is the much much more commonly used term there and thus
using the acronym is preferable. Also note how I used TCP instead of
Transmission Control Protocol there.
Doctrine, as listed in the references section of the RFC, has also opted
to use the full names in their `Order` enum. Based on this Stack
Overflow answer, using the full name also seems to be more common in the
C# ecosystem: https://stackoverflow.com/a/22963304
Given it's also a strongly typed enum case rather than a “magic string”
such as `'ASC'`, I expect IDE autocompletion to reduce much of the
typing effort.
Best regards
Tim Düsterhus