ReflectionEnumUnitCase::getValue

(PHP 8 >= 8.1.0)

ReflectionEnumUnitCase::getValueGets the enum case object described by this reflection object

Description

public ReflectionEnumUnitCase::getValue(): UnitEnum

Returns the enum case object described by this reflection object.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

The enum case object described by this reflection object.

Exemples

Exemple #1 ReflectionEnum::getValue() example

<?php
enum Suit
{
case
Hearts;
case
Diamonds;
case
Clubs;
case
Spades;
}

$rEnum = new ReflectionEnum(Suit::class);

$rCase = $rEnum->getCase('Diamonds');

var_dump($rCase->getValue());
?>

L'exemple ci-dessus va afficher :

enum(Suit::Diamonds)

Voir aussi

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top