ReflectionEnumUnitCase::getValue
PHP function
Edit on GitHub ✎
(PHP 8 >= 8.1.0)
Gets the enum case object described by this reflection object
Description
ReflectionEnumUnitCase::getValue(): UnitEnum
Returns the enum case object described by this reflection object.
Parameters Parameters
Return Values
The enum case object described by this reflection object.
Examples
ReflectionEnum::getValue example
php
<?php
enum Suit
{
case Hearts;
case Diamonds;
case Clubs;
case Spades;
}
$rEnum = new ReflectionEnum(Suit::class);
$rCase = $rEnum->getCase('Diamonds');
var_dump($rCase->getValue());
?>The above example will output:
output
enum(Suit::Diamonds)