Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129541 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 831AF1A00BC for ; Thu, 4 Dec 2025 08:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764835297; bh=yAL/xW6DnhG5SkEmCECmzgKYcB36wbMPZiEzCUgQIPY=; h=Date:From:To:Subject:In-Reply-To:References:From; b=VHBvco3BOnxhNFgfM+oPVdd0O7gUADKdcOOHx1VKtiHdwSpzrshWTF0bUKTOCyqxW KwTlvuj+bbZlsdWjmOCy+VjiwTqbYTGINZJWC1EteL04Y31Ps7yvBBwkt0scaNqaRL MUzBSOh2HPpEF/MZDlxTQKdw6VX1XdJDAtBisO8HcRM8/xjwrNwRKdOKoMYNJy+vKR cD23MZ45J8+WWymlNDAqAzdFOhF+ZzCSkbk95Dvc5Rc5UOFp2IXzT2iQvHmbvtjU7z o63emAxcDFEueSqiY9OVOrLrpk1MLIvdmSWwN4+uc8aJ/I53tMAm+VgmUkL/sx74gf +w/2UyPdHsO+g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F36AE180072 for ; Thu, 4 Dec 2025 08:01:35 +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=-2.8 required=5.0 tests=BAYES_00,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: No X-Envelope-From: Received: from fhigh-b2-smtp.messagingengine.com (fhigh-b2-smtp.messagingengine.com [202.12.124.153]) (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 ; Thu, 4 Dec 2025 08:01:35 +0000 (UTC) Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id B2B1E7A0197 for ; Thu, 4 Dec 2025 03:01:29 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Thu, 04 Dec 2025 03:01:29 -0500 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=fm1; t=1764835289; x=1764921689; bh=yAL/xW6DnhG5SkEmCECmzgKYcB36wbMPZiEzCUgQIPY=; b= Pbo5Xj54LqEwMPhXkdzcgec2MH5uCWu0vLJDhbdTn6AjwOeiV5FGI8Bxe+U+wzpQ lBX+Lnkd55/DVfUyEWWPs76jNEqh8J8W8jMJcgok9+LvKgD8SiGzb4Jxmgt/0Tga 6Uc1PjHaKKwvY2TTL/iIstZkOTNlFB31zPnJzbjQWZfol4JQ8CDZC3DvAxHchsqT 1haYq5Zc1WGfY++VL4z5IdHRymOKicMenEuH8QPWS3v866/lSoB4ZBSzyWl1moq9 KB25BoXmOds0QXVhbvw6ILNuUZA8gZokeQpR9wrIjPpHFgkW7BDEvZlg9CcG+4Ua G7pRCEiejqmDib9KIXWTbg== 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=1764835289; x=1764921689; bh=y AL/xW6DnhG5SkEmCECmzgKYcB36wbMPZiEzCUgQIPY=; b=AIbAKXHZl//mtEvEL 1ttol8TRekVCEmtzWfpGB31GipCDIgwjT7i+NkpJwJqq1RtEZnQMx9af22aokvf6 jBetTT7XyEupFbr/Q0XdWJdT1BqZrIosi/5qWnw4kZ2fweh+zvgtvYuHZqc+MrKF KhX1ZpW294iOU8LM6PnHMoAI109a6P+AMEXVMLOzXQJ4UM2WVTAV0Nx0Nk22j1F2 Fy9KyBEvK/MzKMh1MaGR+xuW1lC+Oj0bbEddUFOYJtPJsiVOlg/Z8eAFJp1aJemT Jn7+tizAX7jGrqWNGL5UvmoOS+717sYFpWkaPsp0lUMPnvKgWBpkXH9qJvHRCN7j yUgPw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdehtdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucenucfjughrpeffhffvufgfjghfkfggtgfgsehtqhhmtddtre ejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhnshculgfkoffuohfrngdfuceoihhm shhophdrphhhphesrhifvggtrdgtohdruhhkqeenucggtffrrghtthgvrhhnpedtfeejtd evgfegjeeuffdviedukeeftdfgkefgvdefkeetffejtdefveegtdeukeenucffohhmrghi nhepphhhphdrnhgvthdpghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepihhmshhophdrphhhphesrhifvggtrdgtohdr uhhkpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhope hinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 4 Dec 2025 03:01:28 -0500 (EST) Date: Thu, 04 Dec 2025 08:01:27 +0000 To: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] [Discussion] Stringable Enums User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: <3D90E174-23F2-4B90-B881-20A0AD30CF0C@rwec.co.uk> Precedence: list list-help: list-unsubscribe: list-post: List-Id: 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 4 December 2025 04:50:57 GMT, Daniel Scherzer wrote: >Hi internals, > >I'd like to start the discussion for a new RFC about removing the >prohibition on `__toString()` methods on enums=2E > >* RFC: https://wiki=2Ephp=2Enet/rfc/stringable-enums >* Implementation: https://github=2Ecom/php/php-src/pull/20415 My first instinct was that this was dragging up a discussion we've had lot= s of times, but your examples make clear that you are *not* just talking ab= out converting enums to their backing value=2E=20 On the other hand, that does make me wonder: in what way is (string)$foo c= learer than $foo->toString() for those use cases? In my experience, it just= makes the functionality less discoverable - people don't think to try (str= ing)$exception or (string)$simpleXmlNode, so miss that those have specific = behaviour=2E And is it even a good name for those methods? In the date-time package, fo= r instance, it would be better named toEnglishName() or getFullEnglishName(= ), as its docblock explicitly says=2E In the framework code, it seems to be= used for a property called $displayValue, so the obvious name for the meth= od would be getDisplayValue()=2E Regards, Rowan Tommins [IMSoP]