Value listing
Both Pure Enums and Backed Enums implement an internal interface named
UnitEnum. UnitEnum
includes a static method
cases()
. cases()
returns a packed array of
all defined Cases in the order of declaration.
<?php
Suit::cases();
// Produces: [Suit::Hearts, Suit::Diamonds, Suit::Clubs, Suit::Spades]
?>
Manually defining a cases()
method on an Enum will result in a fatal error.