public function enum($subject, array $allowedValues) : bool
    {
        if (!$allowedValues) {
            throw new InvalidArgumentException('Arg allowedValues is empty.');
        }
        if ($subject !== null && !is_scalar($subject)) {
            return false;
        }
        $i = -1;
        foreach ($allowedValues as $allowed) {
            ++$i;
            if ($allowed !== null && !is_scalar($allowed)) {
                throw new InvalidArgumentException(
                    'Arg allowedValues bucket ' . $i . ' type[' . Utils::getType($allowed) . '] is not scalar or null.'
                );
            }
            if ($subject === $allowed) {
                return true;
            }
        }
        return false;
    }
public function enum($subject, array $allowedValues) : bool
    {
        if (!$allowedValues) {
            throw new InvalidArgumentException('Arg allowedValues is empty.');
        }
        if ($subject !== null && !is_scalar($subject)) {
            return false;
        }
        $i = -1;
        foreach ($allowedValues as $allowed) {
            ++$i;
            if ($allowed !== null && !is_scalar($allowed)) {
                throw new InvalidArgumentException(
                    'Arg allowedValues bucket ' . $i . ' type[' . Utils::getType($allowed) . '] is not scalar or null.'
                );
            }
            if ($subject === $allowed) {
                return true;
            }
        }
        return false;
    }
public function enum ( $ subject , array $ allowedValues ) : bool { if ( ! $ allowedValues ) { throw new InvalidArgumentException ( 'Arg allowedValues is empty.' ) ; } if ( $ subject !== null && ! is_scalar ( $ subject ) ) { return false ; } $ i = - 1 ; foreach ( $ allowedValues as $ allowed ) { ++ $ i ; if ( $ allowed !== null && ! is_scalar ( $ allowed ) ) { throw new InvalidArgumentException ( 'Arg allowedValues bucket ' . $ i . ' type[' . Utils :: getType ( $ allowed ) . '] is not scalar or null.' ) ; } if ( $ subject === $ allowed ) { return true ; } } return false ; }
Compares type strict, and allowed values must be scalar or null.

@param mixed $subject
@param array $allowedValues
[
0: some scalar
1: null
3: other scalar
]

@return bool

@throws InvalidArgumentException
Arg allowedValues is empty.
A bucket of arg allowedValues is no scalar or null.
Compares type strict and allowed values must be scalar or null .