On 09/07/2025 17:39, Deleu wrote:
It's currently undeniable that a Unit Enum name is a string.


So is a class name, as accessed by $foo::class.

$foo->name on an enum case is really just the same kind of pseudo-reflection, in my view: it's telling you information about the source code, useful primarily for debugging.

If you want to associate a single string value with each enum case, use a string-backed enum, and propose some short-hand syntax. Please leave unit enums as opaque objects for those of us who see value in that.


--
Rowan Tommins
[IMSoP]

Reply via email to