PHP 8.1 supports enums natively.
They are not direct replacements for dasprid/enum as they don't support instance properties. However, all usages of properties in this library are for private properties, which could easily be replaced by a getter method using match($this) instead to provide the value currently provided in the protected constant defining the constructor argument for dasprid/enum.
This will require being done in a new major version as not extending DASPRiD\Enum\AbstractEnum anymore is technically a BC break. However, I doubt consumers of the library are using AbstractEnum as type in the code.
To ease migration, it probably make sense to provide (deprecated?) static methods for each case and a name() method returning $this->name, as a BC layer for the current public API (which is the impactful part of consumers of the library if it is removed directly instead of being only deprecated or kept around forever as non-deprecated).
PHP 8.1 supports enums natively.
They are not direct replacements for
dasprid/enumas they don't support instance properties. However, all usages of properties in this library are for private properties, which could easily be replaced by a getter method usingmatch($this)instead to provide the value currently provided in the protected constant defining the constructor argument fordasprid/enum.This will require being done in a new major version as not extending
DASPRiD\Enum\AbstractEnumanymore is technically a BC break. However, I doubt consumers of the library are usingAbstractEnumas type in the code.To ease migration, it probably make sense to provide (deprecated?) static methods for each case and a
name()method returning$this->name, as a BC layer for the current public API (which is the impactful part of consumers of the library if it is removed directly instead of being only deprecated or kept around forever as non-deprecated).