Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127978 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 F2A401A00BC for ; Wed, 9 Jul 2025 17:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1752080337; bh=qK0sWgvWWjGvjIKrrHtkok1pffuapx1bG81jR+VWmCc=; h=Date:From:To:Subject:In-Reply-To:References:From; b=C6pmJ2ljQMDbDKNlnn67WKF+BGaUHBuwTgM4WJu9X127jnMv7V6czOVmi7eBJAzke VlIFkka2qW/iRW6AfuXummPWDVUy93VfVn5DgW5KZEHhk19fBCFF0f0PTIztq4NnI3 wITH4qI0bK6q2uG9QH+RUYXyeeX+tvQWD/Z1IJPE6TJAMChtDZeMVXqtGfkYvztiXy zJ9cQmNyGyfcbczZ3wFk9LkFmyO9PjEy2U5Xf+oA8fSChDicU5H091tbh/R6W2zJ2z ZM3yII8YmT8w9lUHblLn1e2i4CkHN1Th/DyJR0uV4R+7HdEk1baK6ONrXvgvmMJAJE NM/x+5yEPZRhA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CB97E1804E4 for ; Wed, 9 Jul 2025 16:58:56 +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.9 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fhigh-a4-smtp.messagingengine.com (fhigh-a4-smtp.messagingengine.com [103.168.172.155]) (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 ; Wed, 9 Jul 2025 16:58:56 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 3A55214003AF for ; Wed, 9 Jul 2025 13:00:46 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Wed, 09 Jul 2025 13:00:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; 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=fm2; t=1752080446; x=1752166846; bh=qK0sWgvWWjGvjIKrrHtkok1pffuapx1bG81jR+VWmCc=; b= Gh6PQulLtUuj+wmcjBs0VB/LzkcrkBqHzeg4eQ6FSZsRQ94Dn3BqeaT6rUpMwBpv gWUnRkBXF03NuEru//UX8wjI+LlGrz8SbtjTSyGGF9nSNT3VsDvzw2WYPQ9lxNey QMdBu3GsKYEq13ypZpp5PR0QhUrxaY+5PXh1jAm2NWEkHjGylDR53p3z67n6VxHX qQlkUxk1VkZSL5G12F3VJ5WcPljzi0VWvBmIEQnYxuj0hCGWSZe9IdBbzc1TgFY/ gdVgE4BOOV9FgrUiETXTLxGgWFx0+l7mhN/UhL52Jz9lfRPnJnn4ZfI/CH+wLgIN QaGMlM2cAm36Xw7ZS1jkGQ== 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=fm2; t=1752080446; x=1752166846; bh=q K0sWgvWWjGvjIKrrHtkok1pffuapx1bG81jR+VWmCc=; b=X/dhHSrbdORpabkrz 6GqZsBZ4NXI6bDzaGtw2pOf7w8VB/yMABLmm3+JcdjPHn8MmPm/WtrpJHFUq12wH rRekn7g4U4IY0QpScmPB1JNKTbXHupXhpnuoYv7BjHXzT1fqWHSCMCg51tHsa5wT K42nJ6HkP4ehJbbTDLmmWdgqpgpWbzwi0uFOpK6LCq9iQ+h5kSvGZeVcoWcKMRSE d9zNONxNQrhjlXgp7mjIceDH4d0FWYA224TBdAOhqLHSKIqAVp6a5Km2y0i7fJhL HcFfpxwaLSfzpeYxaft84NSmKhoWJ+Nas8luL0FTMq2WHvKm2EFZkujUoBq22uzx EC7bg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdefkeduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhepfffhvffufggjfhfkgggtgfesthhqmhdttd erjeenucfhrhhomhepfdftohifrghnucfvohhmmhhinhhsucglkffoufhorfgnfdcuoehi mhhsohhprdhphhhpsehrfigvtgdrtghordhukheqnecuggftrfgrthhtvghrnhepheelff etiefgveduteefudegtdduveeludegueegleehiefhhefgtdekveevgfelnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihhmshhophdrphhhph esrhifvggtrdgtohdruhhkpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 9 Jul 2025 13:00:45 -0400 (EDT) Date: Wed, 09 Jul 2025 17:39:02 +0100 To: internals@lists.php.net Subject: Re: [PHP-DEV] ::from() and tryFrom() on Basic Enums User-Agent: K-9 Mail for Android In-Reply-To: <5a38b818-8366-4edc-93ab-a147e3a9aec3@app.fastmail.com> References: <5a38b818-8366-4edc-93ab-a147e3a9aec3@app.fastmail.com> Message-ID: <6DD5AAAE-9D75-4A58-BCB7-A2DFFBF668FF@rwec.co.uk> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 9 July 2025 17:12:52 BST, Rob Landers wrote: > I=E2=80=99ve been thinking of a =E2=80=9Cquality-of-life RFC=E2=80=9D fo= r obvious enums, for some time now=2E Basically, backed enums without a val= ue receive the =E2=80=9Cobvious=E2=80=9D value=2E So a string backed enum g= ets the name, while an int gets the ordered number=2E=20 I agree that this is a more fruitful direction=2E It allows users to say "= the value of this case *happens right now* to match its name", but still ke= eps name and value as strictly separate concepts=2E Importantly, it should be possible to mix default and non-default values o= n one enum, for refactoring, e=2Eg=2E you might want to change an auto-valu= ed "case ZendFramework;" to an explicit "case Laminas=3D'ZendFramework';" o= r "case ZendFramework=3D'Laminas';" without rewriting all the other cases o= n the enum=2E It could even be a specific short-hand syntax on the case, like "case Zend= Framework =3D auto" or "case ZendFramework =3D _"=2E Rowan Tommins [IMSoP]