Re: [RFC] [Discussion] Debugable enums
| From: | Daniel Scherzer | Date: | Sun, 15 Mar 2026 18:04:25 +0000 |
| Subject: | Re: [RFC] [Discussion] Debugable enums | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130359@lists.php.net to get a copy of this message | ||
On Sun, Mar 15, 2026 at 11:01 AM Ilija Tovilo <tovilo.ilija@gmail.com>
wrote:
> Hi Daniel
>
> On Fri, Mar 13, 2026 at 1:06 AM Daniel Scherzer
> <daniel.e.scherzer@gmail.com> wrote:
> >
> > 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/214251(è^Ó!îÚí
> > =ˆ°¸ú
>
> The RFC currently only mentions:
>
> > var_dump(Foo::Bar); // produces an array with "Bar is a case of the Foo
> enum"
>
> But it would be good for it to spell out the full output for the
> examples.
>
Done, examples now show the full output
> From the implementation, I can see:
>
> > object(Foo)#%d (1) {
> > [0]=>
> > string(14) "Foo::Bar = Baz"
> > }
>
> I think the enum(Foo::Bar) header should be preserved. If the user
> wants to print some ancillary data for some reason, I wouldn't object
> to that.
>
Done, the header is now preserved. I also removed the object handler
identifier, which I don't think is as needed with enums.
Based on my understanding of the RFC policy (
https://github.com/php/policies/blob/main/feature-proposals.rst),
this
qualifies as a major change, so there is now a cooldown period of 14 days
before the earliest that a vote could start.
-Daniel