I am wondering why it is not possible to provide an __toString
implementation for enum.
IDE says "Enum may not include '__toString'". However it was the first thing I thought about once I created enum. Previously I used Value Objects encapsulating strings in my code, which utilized string casting when necessary. Now I would like to migrate 'em into enums, but those resist.
#[Immutable]
enum SaveKlinesFromApiQueue: string
{
case DEFAULT = 'save_klines_from_api_queue';
case PRIORITY = 'save_klines_from_api_priority_queue';
public function __toString(): string
{
return $this->value;
}
}