src/Exception/UnexpectedTypeException.php
public static function throwIfNot($actualObject, string $expectedType, bool $allowNull = false): void
    {
        if (!is_a($expectedType, $expectedType, true)) {
            if (\gettype($actualObject) !== $expectedType) {
                if (null === $actualObject && $allowNull) {
                    return;
                }
                throw new self($expectedType, $actualObject);
            }
            return;
        }

        if (!$actualObject instanceof $expectedType) {
            if (null === $actualObject && $allowNull) {
                return;
            }
            throw new self($expectedType, $actualObject);
        }
    }
public static function throwIfNot($actualObject, string $expectedType, bool $allowNull = false): void
    {
        if (!is_a($expectedType, $expectedType, true)) {
            if (\gettype($actualObject) !== $expectedType) {
                if (null === $actualObject && $allowNull) {
                    return;
                }
                throw new self($expectedType, $actualObject);
            }
            return;
        }

        if (!$actualObject instanceof $expectedType) {
            if (null === $actualObject && $allowNull) {
                return;
            }
            throw new self($expectedType, $actualObject);
        }
    }
public static function throwIfNot ( $ actualObject , string $ expectedType , bool $ allowNull = false ) : void { if ( ! is_a ( $ expectedType , $ expectedType , true ) ) { if ( \ gettype ( $ actualObject ) !== $ expectedType ) { if ( null === $ actualObject && $ allowNull ) { return ; } throw new self ( $ expectedType , $ actualObject ) ; } return ; } if ( ! $ actualObject instanceof $ expectedType ) { if ( null === $ actualObject && $ allowNull ) { return ; } throw new self ( $ expectedType , $ actualObject ) ; } }
Throw an UnexpectedTypeException if actual object doesn't match expected type.

@param        $actualObject
@param string $expectedType
@param bool   $allowNull
@throws UnexpectedTypeException
Throw an UnexpectedTypeException if actual object doesn t match expected type .