final public static function fromName(string $name): Enum
    {
        $constName = sprintf('%s::%s', static::class, $name);

        if (!defined($constName)) {
            $message = sprintf('%s is not a member constant of enum %s', $name, static::class);
            throw new DomainException($message);
        }

        return new static(constant($constName));
    }
final public static function fromName(string $name): Enum
    {
        $constName = sprintf('%s::%s', static::class, $name);

        if (!defined($constName)) {
            $message = sprintf('%s is not a member constant of enum %s', $name, static::class);
            throw new DomainException($message);
        }

        return new static(constant($constName));
    }
final public static function fromName ( string $ name ) : Enum { $ constName = sprintf ( '%s::%s' , static :: class , $ name ) ; if ( ! defined ( $ constName ) ) { $ message = sprintf ( '%s is not a member constant of enum %s' , $ name , static :: class ) ; throw new DomainException ( $ message ) ; } return new static ( constant ( $ constName ) ) ; }
Creates instance from an enum constant name

@param string $name The enum constant name

@return Enum

@throws DomainException When the name is invalid
Creates instance from an enum constant name