Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129546 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 ED5FB1A00BC for ; Thu, 4 Dec 2025 13:36:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764855383; bh=I6K/RuPR8z5oviqa2xp+1BIHMnPpp2dSgvS2FhR0NDs=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=LYWaTBgS2iVfh58lFjNXAyI0bWLAhbPgjOPSavxFXX8RKqTEkv3Y+5JSCOQftusAm zX43Lmk20+4cfxysl048STK8dX2y8Sw3Oy6UQKWhmsuzggy8zF9bqMrT+rQtvt3bKr 3p4LQsh29qzyY8H/ksAGU5vUdNTJZb4NrttrlRihjfxciEs3xiGGhk1+qyPta8uTaZ Lh8RPMxlQYnpW560rzKebkYntVnx1konOHzzDZxvEF1iwyOjPS/ixo4fFi1wbHVyu3 l+pAh2LrL8HLFLXDdHwf4S/a9IoDmhh92j0x6KJ/KRhHpBERF76e2oDrSD6/GX+Jb5 DkwH+8gcr4DYg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5BBC4180080 for ; Thu, 4 Dec 2025 13:36:22 +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=3.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) (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 13:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764855375; bh=I6K/RuPR8z5oviqa2xp+1BIHMnPpp2dSgvS2FhR0NDs=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=Jf5bc+FKhsl1B4jRWmcsudo1yvuOGDTd0e96ofg0Ap52lBfoEzrPp8nP2mNNO6mNW SiZo8hEj+wOi5VfZO1mEcZ3Ps7R7bT7mi6F0I4erwoLSet/WzcxnjjbrZ+fzUEWzSh Ipvg+mEjKb1F8Ub9V203q0f4NgIaNzQUvIRZ10z3sOoWGnHYbXBheI/huSu9ql4TAt fU55266usbfNnbqOtOcd3HZOFxboiab6hINWJHNZp+9ir61uR+K8Vp2XQwWNS14eUW AnKbTPrZSIxinByor9OmuhKkk264k9j7l7PsFulksAeqK8CCBnD7R3TiWqnbQ6hq02 RHMAkhs95sGZg== Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 30EC110C584; Thu, 04 Dec 2025 13:36:15 +0000 (GMT) Date: Thu, 4 Dec 2025 13:36:14 +0000 (GMT) To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= cc: "Rowan Tommins [IMSoP]" , internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] [Discussion] Stringable Enums In-Reply-To: <31ed0152483193e85ca3a9eebc5e6d14@bastelstu.be> Message-ID: <7497bedc-a13e-a627-f733-cb2495249e63@php.net> References: <3D90E174-23F2-4B90-B881-20A0AD30CF0C@rwec.co.uk> <31ed0152483193e85ca3a9eebc5e6d14@bastelstu.be> Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1321413495-1764855375=:29692" From: derick@php.net (Derick Rethans) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1321413495-1764855375=:29692 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 4 Dec 2025, Tim D=C3=BCsterhus wrote: > Hi >=20 > Am 2025-12-04 09:01, schrieb Rowan Tommins [IMSoP]: > > > And is it even a good name for those methods? In the date-time=20 > > package, for instance, it would be better named toEnglishName() or=20 > > getFullEnglishName(), as its docblock explicitly says. In the=20 > > framework code, it seems to be used for a property called=20 > > $displayValue, so the obvious name for the method would be=20 > > getDisplayValue(). >=20 > I fundamentally disagree with the proposal for reasons similar to those t= hat > Rowan mentioned. More specifically, I consider implementing `__toString()= ` to > be a mistake, unless it is for a debug representation. I agree, and also: We usually have a `__debugInfo()` method for debugging purposes. Instead=20 of allowing `__toString()` to be added, I think I would rather see=20 `__debugInfo()` being allowed.=20 It must continue to be not possible to treat enums as strings. cheers, Derick --8323329-1321413495-1764855375=:29692--