This package offers strongly typed enums in PHP. We don't use a simple "value" representation, so you're always working with the enum object. This allows for proper autocompletion and refactoring in IDEs.
By declaring the enum class itself as abstract,
and using static constructors instead of doc comments,
you're able to return an anonymous class per enum, each of them implementing the required methods.
You can use this enum the same way as any other:
Note that one drawback of this approach is that the value of the enum
is always the name of the static function, there's no way of mapping it.