The ReflectionEnum class reports an information about an enum. This class is available in the standard PHP, so for any questions, please look at documentation for ReflectionEnum
Enum cases are represented by the ReflectionEnumUnitCase and ReflectionEnumBackedCase classes, which extend their native counterparts ReflectionEnumUnitCase and ReflectionEnumBackedCase.
final class ReflectionEnum extends \ReflectionEnum
{
public function getBackingType(): ?ReflectionNamedType {}
public function getCase(string $name): ReflectionEnumUnitCase|ReflectionEnumBackedCase {}
public function getCases(): array {}
public function hasCase(string $name): bool {}
public function isBacked(): bool {}
}But be careful, that several methods require the enum to be loaded into the memory, otherwise an exception will be thrown.
- ReflectionEnumUnitCase::getValue / ReflectionEnumBackedCase::getValue — Returns the concrete enum case object