Re: [RFC] [Discussion] Debugable enums
| From: | Larry Garfield | Date: | Fri, 13 Mar 2026 14:54:18 +0000 |
| Subject: | Re: [RFC] [Discussion] Debugable enums | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130308@lists.php.net to get a copy of this message | ||
On Thu, Mar 12, 2026, at 7:05 PM, Daniel Scherzer wrote:
> Hi internals,
>
> I'd like to start the discussion for a new RFC about removing the
> prohibition on __debugInfo() methods on enums.
>
> * RFC: https://wiki.php.net/rfc/debugable-enums
> * Implementation: https://github.com/php/php-src/pull/21425
>
> This is a replacement of my earlier RFC to allow __toString() based on
> the feedback in that discussion, see
> https://news-web.php.net/php.internals/129540.
>
> Thanks,
> -Daniel
I'm not entirely sure this has much value, but it also seems to not have much downside. The
main argument I could see for holding off is that whenever it is we get to ADTs, we may want a more
complex default implementation. But that would still presumably allow being overridden, like any
other class, so it doesn't seem like a landmine to me. This doesn't have the same
semantic issues that __toString() has (and have been discussed elsewhere).
--Larry Garfield