Since: 8.1

interface BackedEnum implements UnitEnum (View source)

Properties

int|string $value

Methods

static array
cases()

No description

from  UnitEnum
static BackedEnum
from(int|string $value)

Translates a string or int into the corresponding Enum case, if any. If there is no matching case defined, it will throw a ValueError.

static BackedEnum|null
tryFrom(int|string $value)

Translates a string or int into the corresponding Enum case, if any. If there is no matching case defined, it will return null.

Details

static array cases()

No description

Return Value

array

static BackedEnum from(int|string $value)

Translates a string or int into the corresponding Enum case, if any. If there is no matching case defined, it will throw a ValueError.

Parameters

int|string $value

Return Value

BackedEnum

Exceptions

ValueError
TypeError

static BackedEnum|null tryFrom(int|string $value)

Translates a string or int into the corresponding Enum case, if any. If there is no matching case defined, it will return null.

Parameters

int|string $value

Return Value

BackedEnum|null

A case instance of this enumeration, or null if not found.