Hi
On 11/12/25 19:42, Faizan Akram Dar wrote:
I personally don't see any added value by adding such a method to enums at
this point when getting the equivalent results is already possible by a one
liner.
`array_column(EnumFqcn::cases(), 'value');`
I agree with that. I feel that BackedEnums are already over-used to the
point where they just act as “fancy strings” instead of a proper data
type on their own and I don't think we should further encourage treating
enums as fancy strings.
In addition to that, a custom implementation of the method is trivially
done as shown by Faizan and doesn't even need to be made available by
the author of the enum but can be written on demand when having all
values (without the corresponding names) is necessary.
And even when there is not a BC break right now, by not actually
fixating the signature in the interface, it would be with PHP 9.0 and
from then on it would (needlessly) block another method on enums that
folks might otherwise be interested in using, since the name is very
generic. Even when never adding it to the interface - static methods on
interfaces are odd - it would break user expectations that some enum
methods can be redefined and others can't.
Best regards
Tim Düsterhus