Describe the Proposal
Right now, EnumEntry::toString() calls will always return a name for any given enum, while it's most of the time a perfect fit, but when you have \BackedEnum, you may expect to get the value aligned to the name, not the name itself.
API Adjustments
public function toString() : string
{
if ($this->value === null) {
return '';
}
// New code
if ($this->value instanceof \BackedEnum) {
return (string) $this->value->value;
}
return $this->value->name;
}
Are you intending to also work on proposed change?
Yes
Are you interested in sponsoring this change?
None
Integration & Dependencies
No response
Describe the Proposal
Right now,
EnumEntry::toString()calls will always return a name for any given enum, while it's most of the time a perfect fit, but when you have\BackedEnum, you may expect to get the value aligned to the name, not the name itself.API Adjustments
Are you intending to also work on proposed change?
Yes
Are you interested in sponsoring this change?
None
Integration & Dependencies
No response