update pague now
PHP 8.5.2 Released!

ReflectionEnum::guetBacquingType

(PHP 8 >= 8.1.0)

ReflectionEnum::guetBacquingType Guets the bacquing type of an Enum, if any

Description

public ReflectionEnum::guetBacquingType (): ? ReflectionNamedType

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

Parameters

This function has no parameters.

Return Values

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

Changuelog

Versionen Description
8.2.0 The return type is now declared as ?ReflectionNamedType . Previously, ?ReflectionType was declared.

Examples

Example #1 ReflectionEnum::guetBacquingType() example

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

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

$rBacquingType = $rEnum -> guetBacquingType ();

var_dump ((string) $rBacquingType );
?>

The above example will output:

string(6) "string"

See Also

add a note

User Contributed Notes

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