Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130228 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 3C27B1A00BC for ; Mon, 2 Mar 2026 22:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1772489585; bh=XZqZUmQg3qdJjONcgGeA5DIqVxc0PVoPq/Mhe0AMnpw=; h=Date:Subject:To:References:From:In-Reply-To:From; b=Kr+F+xn+oTHum9oYwMV9Qh68tGX4xZcVRclXB5xk+kq59QM+qrLxXYLw9HHnqHUqd 9FqENmeaxqeqv1oLZsPifXdpmgz9dmnxZLrLZcZjGvw1ERUBc1IPAd/yMIOxHLscnh mtW8PWj/MquaZXXfGRfGujjcW55Me+f/HbFMn61KFP6ZIy0K6bQYb46xWopltxIDjm eaCtpFcfBdDW8XdSJO0F95WrGhkO0Ucn/cnhR9h+EpXY8vzSiPAQsDgZmwXXQQkAGa VTVV72UhJzqL+vPYhHcuedvuk5jqq5jFU2mbp8hVZouPFT76lcoBKd8GL4wCStV603 fcXzEZ0ARSbkA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D6FD91805D3 for ; Mon, 2 Mar 2026 22:13:04 +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 ; Mon, 2 Mar 2026 22:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1772489577; bh=i6hIxvVSrtKGrfJoqWJ7eVvXxayh3giRzdW+FhnYtZI=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=exgU/dnwAXE6TkHZDJnTukZGVcan2TgZZRWXCSjfTvxKXZVs0DDj+rBeISqelvBjk ApyChP9AyV6aSV3g3Zcpcqra1mSUnKKHI39lrOHrLFVZtiOtsFKgxeEQhAQgt3Gd57 sn2zH+Y3dDGafSlUaj6D8DDEPec5pcyYtuQnT8saA2T+N1f/mjV8rxeS8DedGH9nLy F0RrnNXcUIjwXyVzSXS0wL7K75sazvRK4yOsOmDF7QT29X/yQEIqJBEIJlB3+tPBIf c0ft22+wQpJt96/JRl3cc46uOD2raDO37UK4fps/EPt+GpjKzLqatiQmPvIqATmAGg lw7JRNDY11BAg== Message-ID: <19249e75-ba91-42fa-8eb4-3ef1375f0497@bastelstu.be> Date: Mon, 2 Mar 2026 23:12:56 +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: Bob Weinand , PHP internals References: <5bec7fdd-e2d0-47ab-92d0-ead8eade21e6@bastelstu.be> Content-Language: en-US In-Reply-To: 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/2/26 22:43, Bob Weinand wrote: > 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. A GitHub search for "language:PHP SORT_ASC" reveals that the existing constants are used in userland code for custom purposes (e.g. within a `switch()` statement). Redefining them to the enum would bring little value, but unnecessarily break them. See also https://wiki.php.net/rfc/correctly_name_the_rounding_mode_and_make_it_an_enum for a precedent (specifically the Future Scope section there). As suggested in the “Future Scope” of the featured RFC widening the core functions to accept the enum and update the default value to the enum case can just happen without an RFC, since this should not be observable except by Reflection. I want to avoid a situation of explicitly listing *some* of the functions in the RFC, missing one and then later having a discussion of whether or not it requires a follow-up RFC to *also* adjust that missed one. Best regards Tim Düsterhus