ReflectionEnum::getBackingType

Gets the backing type of an Enum, if any

&reftitle.description; public ``ReflectionNamedType``null```ReflectionEnum::getBackingType`

If the enumeration is a Backed Enum, this method will return an instance of `ReflectionType` for the backing type of the Enum. If it is not a Backed Enum, it will return `null`.

&reftitle.parameters; &no.function.parameters;
&reftitle.returnvalues;

An instance of `ReflectionNamedType`, or `null` if the Enum has no backing type.

&reftitle.changelog;

&Version; | &Description;
8.2.0 | The return type is now declared as `?ReflectionNamedType`. Previously, `?ReflectionType` was declared.

&reftitle.examples;

### `ReflectionEnum::getBackingType` example

    <?php
    enum Suit: string
    {
        case Hearts = 'H';
        case Diamonds = 'D';
        case Clubs = 'C';
        case Spades = 'S';
    }

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

    $rBackingType = $rEnum->getBackingType();

    var_dump((string)$rBackingType);
    ?>

&example.outputs;

    string(6) "string"

&reftitle.seealso;

- Enumerations
- `ReflectionEnum::isBacked`