Doctrineum/Scalar/ScalarEnumType.php
public static function addSubTypeEnum(string $subTypeEnumClass, string $subTypeEnumValueRegexp): bool
    {
        if (static::hasSubTypeEnum($subTypeEnumClass)) {
            throw new Exceptions\SubTypeEnumIsAlreadyRegistered(
                'SubType enum ' . ValueDescriber::describe($subTypeEnumClass) . ' is already registered with regexp '
                . self::$enumSubTypesMap[static::getSubTypeEnumInnerNamespace()][$subTypeEnumClass]
                . ' (requested to register with regexp ' . ValueDescriber::describe($subTypeEnumValueRegexp) . ')'
            );
        }
        /** The class has to be self-registering to by-pass enum and enum type bindings, @see ScalarEnum::createEnum */
        static::checkIfKnownEnum($subTypeEnumClass);
        static::guardRegexpValid($subTypeEnumValueRegexp);
        self::$enumSubTypesMap[static::getSubTypeEnumInnerNamespace()][$subTypeEnumClass] = $subTypeEnumValueRegexp;

        return true;
    }
public static function addSubTypeEnum(string $subTypeEnumClass, string $subTypeEnumValueRegexp): bool
    {
        if (static::hasSubTypeEnum($subTypeEnumClass)) {
            throw new Exceptions\SubTypeEnumIsAlreadyRegistered(
                'SubType enum ' . ValueDescriber::describe($subTypeEnumClass) . ' is already registered with regexp '
                . self::$enumSubTypesMap[static::getSubTypeEnumInnerNamespace()][$subTypeEnumClass]
                . ' (requested to register with regexp ' . ValueDescriber::describe($subTypeEnumValueRegexp) . ')'
            );
        }
        /** The class has to be self-registering to by-pass enum and enum type bindings, @see ScalarEnum::createEnum */
        static::checkIfKnownEnum($subTypeEnumClass);
        static::guardRegexpValid($subTypeEnumValueRegexp);
        self::$enumSubTypesMap[static::getSubTypeEnumInnerNamespace()][$subTypeEnumClass] = $subTypeEnumValueRegexp;

        return true;
    }
Warning: Behave of registering more classes on same regexp (or simply matching same string) is undefined.

@param string $subTypeEnumClass
@param string $subTypeEnumValueRegexp
@return bool
@throws \Doctrineum\Scalar\Exceptions\SubTypeEnumIsAlreadyRegistered
@throws \Doctrineum\Scalar\Exceptions\SubTypeEnumClassNotFound
@throws \Doctrineum\Scalar\Exceptions\SubTypeEnumHasToBeEnum
@throws \Doctrineum\Scalar\Exceptions\InvalidRegexpFormat