Re: String enums & __toString()
| From: | Gina P. Banyard | Date: | Sat, 17 Aug 2024 22:24:14 +0000 |
| Subject: | Re: String enums & __toString() | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125034@lists.php.net to get a copy of this message | ||
On Saturday, 17 August 2024 at 22:27, John Coggeshall <john@coggeshall.org> wrote:
> As it seems to me there isn't a particularly strong argument for why we don't allow
> __toString() , would anyone have a strong objection to getting an RFC going to get this voted on? I
> didn't look closely at the original PR from the "auto implement __toString()" for
> string-backed enums, but I think this might literally be a one-liner just to enable enums to
> implement __toString() and the rest can be tossed.
I would vote against such a proposal because I fundamentally disagree from a language design
principle.
I do tend to agree with Rowan that Stringable and the __toString() magic method overall is.... less
than ideal.
Best regards,
Gina P. Banyard