Description
Description
This idea came up while looking at this mess. I figured it would be nice if you could just pass ->enumNode(BackedEnum::cases())
or even ->enumNode(BackedEnum::class)
. Turns out it is possible (the former) thanks to #49098 but then if you do that the users have to also manage to create enum cases like foo: !php/enum \App\Enum\FooEnum::Bar
, which requires a lot of internal knowledge and is not super user friendly.
So my request is.. Could we make it so that if all enumNode cases are actual enum instances and there is no plain string in there, and the enum is backed, then if a string is passed in as value in the config it would do enum::tryFrom(string)
to convert it automatically?
Example
foo: "bar"
would auto-convert to \App\Enum\FooEnum::Bar