Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130247 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 3C3171A00BC for ; Tue, 3 Mar 2026 20:50:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1772571049; bh=Iw8h/gnib2rDsp1OXcS9Lce0HbjGEbO7rIqFr+iq1bY=; h=Date:Subject:To:References:From:In-Reply-To:From; b=lkuMRi8teqhFZHAPgaGC8qtyhUDWzN0sYtew5lIhPTQCrU0Kv1Ydr3dIx6Kp5tR06 YWPCaXvEOp2SpSeQv4pgGesr9bwqe6Zx/AviRqaYQvB1jouPPGmaepRw+IWe0MUuLa NVcqGWsVEeopBco4tgsvMHgB+VhUNFHInaCSlIFaT7BGvUl969U0wc92IjXAA53X3+ Y0Y/OMVhvZ0E9IX5PYhgABduwgUPvfVYX0C9NlmQNXEwW+fB5ag7Q0JHwpglyooK59 8sfC/2Gu5WVBmpqA6S7mpE/RsYZGIjDEOoUFa4p3vSNf0r8X+LZKGCYxQ/KKJChz78 EGpFdYVtZkf2A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9FBBD180084 for ; Tue, 3 Mar 2026 20:50:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 3 Mar 2026 20:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1772571040; bh=onF8J7S/Jf+qbVfWPFCOn/Lg0aSN00Jbm2Y8UTlTYIQ=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=AOyyuX0ujPShoT/a2waCv/rPKSyTGsdVkJR4VjndITXOdNhVA0QXdUte3Wyr+DYlW aRAHB3IT6Y0BjW0XW8Obu1WANO4d4VdlQt9BDGqTt7vrxEfHV2SZ8e/ec+RtJQtGnS VY3F2zrxKNK2yvRgwtUMZXoLKc+RsEMjiFMbu6Zyiu0ABFsUoVcdr+jKJcWBTRcw2o 0yDN1DK59eyEkZO6eR6iOmBpcfl+fvEx/wX+UxLtkCjMwZsG8j1mAteaQZ2fgMI4mY nUCrBm78JiOiw6lQ0Xm0Nm+vuuAFsJj7hlt+WFeDAKjE6McnWtoL0Y3CYddiWbl/7A eUobUKz1lp1AA== Message-ID: <58700a4c-7d1b-4e4b-b6f9-adc5843b0206@bastelstu.be> Date: Tue, 3 Mar 2026 21:50:38 +0100 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Subject: Re: [PHP-DEV] [RFC] enum SortDirection To: Larry Garfield , php internals References: <5bec7fdd-e2d0-47ab-92d0-ead8eade21e6@bastelstu.be> <0fdf66b9-2027-444b-bee5-01bed296e3c9@app.fastmail.com> Content-Language: en-US In-Reply-To: <0fdf66b9-2027-444b-bee5-01bed296e3c9@app.fastmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) 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