Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129557 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 D0F451A00BC for ; Fri, 5 Dec 2025 00:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764894131; bh=s5Luoxc9pIkS6FgebKPEw8FnyuaPpSktz+Vl0rKGCmU=; h=Date:From:To:In-Reply-To:References:Subject:From; b=TUipoPz6ippecl/Txl6D9C1WayilhnY3Q6LqOCpodoiSKV2pwac4aDwXvvHmppb8j ZmoX3/2Yj96ZxRFT2J9PH1TZOCdeaGrJU/Ks7QcLw2e7CoGZnl+yy+cq8sFMpcTclM yK54qoeW+kpGODNOoowXL39d5BkrrNT1yYuMFxl+O+gCzfev3SxVnoZb3LmkFOZurO 9kWdHPcMhnlsPNjqEMSpjZVYLbqmmUO7Z8JXrcNdIUoHkIs71/3IWEarvYd9p1nbFT yBUlauu300S8B33CmwTjcz/blSUTQvBnBWqtFFhfzjZxKUj0cIQ/4vly25A0xET4fh YTZKcqqJUJr2A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0A224180084 for ; Fri, 5 Dec 2025 00:22:10 +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-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.147]) (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 ; Fri, 5 Dec 2025 00:22:09 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 5BEBFEC04EA for ; Thu, 4 Dec 2025 19:22:04 -0500 (EST) Received: from phl-imap-01 ([10.202.2.91]) by phl-compute-04.internal (MEProxy); Thu, 04 Dec 2025 19:22:04 -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=1764894124; x=1764980524; bh=/+BdzaAQySUENB2Bp7mOB AFtZDbnNgRZmyhJwPEVodE=; b=nWlI7WF+1Jvgre2Y5Ivgoj8yJMRIiF+7hxokp VnCu4am+3lWUAdhXXrAQrwd2Ov8GwjpIP2iIBr5KH7ec6k7bOAQybOttiuEdc+2P bByFh0dAtSQGVRehWcWJW3eNVt/10G04GaJNqeD9h6ZldNhJC/PuftPK5MzrDH35 B4tbQ2umZWC7q9xNsO0Td7SrDnQDTTRA+xR2ZkgWiv56HQypCCJkZk0oUbZa4Fwy G50ToVP8QSn1tDvtQBWMKmqiS5O5jQj1rYXXgUrKY25FBX8Ut29MT3WhU6bJogzf VPrMiH2ddfb8bdvt8WLEpmKnsv3vqiHFjTf5W3Dg4MKnVb8ZA== 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=1764894124; x=1764980524; bh=/ +BdzaAQySUENB2Bp7mOBAFtZDbnNgRZmyhJwPEVodE=; b=ejmI2EtEpe3iVYD6a frBrR+S9NNIu5Mu3yB1/oDeYX7FHLGh776Ku8A72clVHgSuW8wBvKkTleKtACl1Y Mhs91prCuuMA6dFlo8j6VAqGXGGYbndXi41ERMIUgia15ynt3QvIisOBsQeZ+PWl ng4ZaoxrqSsTOvl85RVV4ZKDhmYLn9DJ+qywhOXJDixk7jjNVHgcJ+SbI7sIVk0V maVhui6N8xxs0PIK7bnn6XYTvK3lY24jLGykeMpU8qwx4kXcawmkF7RqkZrV5fNB 9cOZhNOh47bxJ4CCloFrK2BHBbc4SpcQuzPIBs9V1lsRoE6yfpCLMzmGkF3vbIOm oPu7g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdeileekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurh epofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhihucfi rghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqeenuc ggtffrrghtthgvrhhnpeffieeivdfhvdeguddttdegteeiueegvefhteehfeeffeetudei tdehtdegjeeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomhdpnhgspghrtghpthht ohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslh hishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 1EDB918C0066; Thu, 4 Dec 2025 19:22:04 -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: ABqgc2PdGi0o Date: Thu, 04 Dec 2025 18:21:43 -0600 To: "php internals" Message-ID: In-Reply-To: References: <3D90E174-23F2-4B90-B881-20A0AD30CF0C@rwec.co.uk> <31ed0152483193e85ca3a9eebc5e6d14@bastelstu.be> <7497bedc-a13e-a627-f733-cb2495249e63@php.net> Subject: Re: [PHP-DEV] [RFC] [Discussion] Stringable Enums Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Thu, Dec 4, 2025, at 2:44 PM, Bob Weinand wrote: > Good point Derick, > > On 4.12.2025 14:36:14, Derick Rethans wrote: >> On Thu, 4 Dec 2025, Tim D=C3=BCsterhus wrote: >> >>> Hi >>> >>> Am 2025-12-04 09:01, schrieb Rowan Tommins [IMSoP]: >>> >>>> And is it even a good name for those methods? In the date-time >>>> package, for instance, it would be better named toEnglishName() or >>>> getFullEnglishName(), as its docblock explicitly says. In the >>>> framework code, it seems to be used for a property called >>>> $displayValue, so the obvious name for the method would be >>>> getDisplayValue(). >>> I fundamentally disagree with the proposal for reasons similar to th= ose that >>> Rowan mentioned. More specifically, I consider implementing `__toStr= ing()` to >>> be a mistake, unless it is for a debug representation. >> I agree, and also: >> >> We usually have a `__debugInfo()` method for debugging purposes. Inst= ead >> of allowing `__toString()` to be added, I think I would rather see >> `__debugInfo()` being allowed. >> >> It must continue to be not possible to treat enums as strings. >> >> cheers, >> Derick > > > Daniel, if you want to improve the magic method situation here, I'd mu= ch=20 > rather encourage you to add __debugInfo() than anything else. > > (Also fwiw I think __toString() should never have existed in the first=20 > place; but that's a wholly different topic.) > > > Bob I've long argued against allowing __toString() for reasons others have a= lready covered, so I won't bother repeating it. But off hand I don't se= e why __debugInfo() would cause a problem. I am not sure it's useful be= fore ADTs happen, but I don't think it would cause any harm? --Larry Garfield