Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130230 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 5C3081A00BC for ; Tue, 3 Mar 2026 00:36:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1772498190; bh=AushA2JQExVJbnwQfEKTmqErrAibaPdrKMNk35XQUok=; h=Date:From:To:In-Reply-To:References:Subject:From; b=byLvA0BuhVp2uWNfVCZ98AGhaJOGBwUUVPly2dcZ4mie5Z5gNvu6hEkTBR7HOS75/ 2dgoP1auWhbQPkTr64+ehKMtmqSa9ZnJ8ppH2KNkIPJr+RiNumswar1owtBdmHbrvn 6CqOzT8cfIy+nnge+wr12ASfQwxmP5LjboKZMA90xO8+MbGI2NQuKAOZFDJk/OUJdt jS9DvwAHYp15oGrXT1T6GJCw2LEU72pjDLiZLkL2Bt93kTCo11b1FGEfjgbKi0K/VE IbArzANWPpg+SKcHPdS/tSRHJDluuUMHExIrUbEJgwUukZmrK2UkgBIJQx5dRYx3me XKhGxH0YDGWqg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 04BA118005B for ; Tue, 3 Mar 2026 00:36:27 +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.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) (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 00:36:26 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 229CAEC062C for ; Mon, 2 Mar 2026 19:36:21 -0500 (EST) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Mon, 02 Mar 2026 19:36:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm1; t=1772498181; x=1772584581; bh=9pwRFRIV8NnkQGtgA+xKZ 2Cs+UmDqPCYwiDENB6L/Co=; b=x6EASB4GJKEwHjo1uw9zWBapYZVvFkvGfkTKB BJBxUZkT9FiDYcIzasn/wQGMHOPrh3mrwcqCGjznZpKz2SU5X/CulWiubzOJJWkh BLdQ2iCIZKatYCr6IrpZXaAQ1+hjYdw3dgA+K0S4RE6283PVBt0Z2aF59Q69yFOW TxNC7HpT+G/7uZtU5A7aNd+9ayiX60hyHsxlQtDUlvzkFfeE+DYa/dblzJmpjPns GViPJRCPxjf3prnoC1Jia4xuukOrUTFfHxFgaetzXPN8BSvwIMF74KLbU+x1/QjU ZnbSeaG9JAjFjWsLp8vwEA3IE2BuRwSxZRfI4YMGbumeUBcrw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1772498181; x=1772584581; bh=9 pwRFRIV8NnkQGtgA+xKZ2Cs+UmDqPCYwiDENB6L/Co=; b=UAub+2gS/vJpzDGB2 O1Iw7t+ShAYGwk7Z+hFt3q9kKC0cijh5cNvSSV78xiaS9ojDTBIY30B+Rq7M3WRs eHZ7NCgFPROs2UM8bB90j0Azo69/l3G9D0XJes0dqQkX3R+VDbIk7Kwelw7j0NKj drAy5Hxwumxw1IJoSxOUAoG6RnAAxMSKWSa5nfxdgzAOulNeiwYo48FwUze/+sMS OiTvTpKfkOIzxc/vrMb2ZWDUoHyhEVnnwEpu3Xk3dJkhZ3zuhars6+2SaU2rea0Z XdCuxGr/e8iiVJfVFjjKNGYW8lILwgO5iO9KiaQU/B4P9BVbWaPb8WxKpeaMElOm fCnkA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvheeludegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeeugfetieejueevffdulefhhfethfekvedtueevgfffvdef iedvtefgheevteelffenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghl ughtvggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 62466700065; Mon, 2 Mar 2026 19:36:20 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: AoO9V6XnWNuZ Date: Mon, 02 Mar 2026 18:36:00 -0600 To: "php internals" Message-ID: <0fdf66b9-2027-444b-bee5-01bed296e3c9@app.fastmail.com> In-Reply-To: References: <5bec7fdd-e2d0-47ab-92d0-ead8eade21e6@bastelstu.be> Subject: Re: [PHP-DEV] [RFC] enum SortDirection Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Mon, Mar 2, 2026, at 4:14 PM, Derick Rethans wrote: > On 2 March 2026 21:43:19 GMT, Bob Weinand wrote: >>Hey Tim, >> >>On 2.3.2026 21:45:39, Tim D=C3=BCsterhus wrote: >>> Hi >>>=20 >>> please consider this email as a formal request for comments on my mo= dest proposal of adding a new `enum SortDirection` to PHP=E2=80=99s stan= dard library. >>>=20 >>> I have made the full proposal available on the World Wide Web at: >>>=20 >>> https://wiki.php.net/rfc/sort_direction_enum >>>=20 >>> Yours sincerely >>> Tim D=C3=BCsterhus >> >> >>That's a good idea, but I wouldn't introduce such class without some u= sages 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 =3D SortDirection::Ascending; - similar for ot= hers 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. > > > > If its a BC break, it can't go into a 8.=C3=97 for something that isn'= t *necessary*. > > But I also don't see how accepting both int and this new enum for=20 > existing built-in functions is a BC break. > > Changing the existing constants to something else is probably not a=20 > good idea, as other user functions or libraries might have reused them= .=20 > > cheers > Derick I concur. I'd like to see the functions updated now in the RFC, so we g= et a sense of how many functions will be impacted. Not because I'm conc= erned about a widened type breaking anything, but more so readers can se= e the value this brings. The Yii DB layer (at least in v2, I haven't used v3 yet) used SORT_ASC/S= ORT_DESC for itself, so I agree that redefining those is unwise. Nit: Should we use Asc and Desc, for more compact code? Enums are great= , but they can get verbose at times. :-) (SortDirection::Descending is = 25 characters long, for what is ultimately a named boolean.) On the whole, though, I'm in favor. =20 --Larry Garfield