On Thu, 4 Dec 2025, Tim Düsterhus wrote:

> Hi
> 
> Am 2025-12-04 09:01, schrieb Rowan Tommins [IMSoP]:
>
> > And is it even a good name for those methods? In the date-time 
> > package, for instance, it would be better named toEnglishName() or 
> > getFullEnglishName(), as its docblock explicitly says. In the 
> > framework code, it seems to be used for a property called 
> > $displayValue, so the obvious name for the method would be 
> > getDisplayValue().
> 
> I fundamentally disagree with the proposal for reasons similar to those that
> 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 
of allowing `__toString()` to be added, I think I would rather see 
`__debugInfo()` being allowed. 

It must continue to be not possible to treat enums as strings.

cheers,
Derick

Reply via email to