src/Decoder.php
protected static function checkType(array $allowedTypes, $type, $value)
    {
        if (count($allowedTypes) && !in_array($type, $allowedTypes)) {
            $allowed = implode(', ', $allowedTypes);
            throw new \InvalidArgumentException(
                "Expected one of: $allowed; got $type"
            );
        }

        return $value;
    }
protected static function checkType(array $allowedTypes, $type, $value)
    {
        if (count($allowedTypes) && !in_array($type, $allowedTypes)) {
            $allowed = implode(', ', $allowedTypes);
            throw new \InvalidArgumentException(
                "Expected one of: $allowed; got $type"
            );
        }

        return $value;
    }
Check the type of a value.

\param array $allowedTypes
Whitelist of allowed types.
If empty, any type is allowed.

\param string $type
The actual type of the value
being tested.

\param mixed $value
The value being tested.

\retval mixed
The original value that was passed
to this method, if type allows.

\throw InvalidArgumentException
The given type cannot be used
in this context (disallowed).