Re: [RFC] [Discussion] Stringable Enums

From: Date: Fri, 05 Dec 2025 15:36:42 +0000
Subject: Re: [RFC] [Discussion] Stringable Enums
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-129564@lists.php.net to get a copy of this message
On Thu, Dec 4, 2025, at 6:32 PM, Bob Weinand wrote: > Hey Larry, > > On 5.12.2025 01:21:43, Larry Garfield wrote: >> I've long argued against allowing __toString() for reasons others have already >> covered, so I won't bother repeating it. But off hand I don't see why __debugInfo() would >> cause a problem. I am not sure it's useful before ADTs happen, but I don't think it would >> cause any harm? > I found to semi-commonly (the ergonomics of querying are bad) add > attributes to enum cases. A __debugInfo() handler could provide > information about all attached metadata. > > > Bob Ah, interesting case. OK, color me unopposed to allowing __debugInfo(), but still opposed to __toString(). --Larry Garfield

« previous php.internals (#129564) next »