On Thu, 9 Feb 2023 at 16:18, Sergii Shymko <ser...@shymko.net> wrote:
> > IMO, other variations of array_column() returning a map don't seem to be > useful in practice. > Particularly, what is knowing the case name good for? Do you propose to > resolve it to the case instance like so? > $case = constant(ExampleEnum::class . '::' . $caseName); > My understanding is that backed enums serve the purpose of doing the > mapping. > The same argument can be made for your validation examples: the enum is "doing the mapping" when you use tryFrom. My opinion on this probably comes from my general opinion of backed enums - to me, the opaque case object is primary, and the "value" is just an arbitrary piece of data attached. I would have preferred to be able to attach any number of such properties, e.g. Options::verbose->longArgumentName, Options::verbose->shortArgumentName. Regards, -- Rowan Tommins [IMSoP]