php / 8.1.5 / class.backedenum.html /

The BackedEnum interface

Introduction

(PHP 8 >= 8.1.0)

The BackedEnum interface is automatically applied to backed enumerations by the engine. It may not be implemented by user-defined classes. Enumerations may not override its methods, as default implementations are provided by the engine. It is available only for type checks.

Interface synopsis

interface BackedEnum extends UnitEnum {
/* Methods */
public static from(int|string $value): static
public static tryFrom(int|string $value): ?static
/* Inherited methods */
public static UnitEnum::cases(): array
}

Table of Contents

© 1997–2021 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.backedenum.php