src/Types/BaseType.php
private static function ensurePropertyType($class, $name, $value)
    {
        $isValid = false;
        $info = self::propertyInfo($class, $name);
        $actualType = self::getActualType($value);
        $valid = explode('|', $info['type']);

        foreach ($valid as $check) {
            if ($check !== 'any' && \DTS\eBaySDK\checkPropertyType($check)) {
                if ($check === $actualType || 'array' === $actualType) {
                    return;
                }
                $isValid = false;
            } else {
                $isValid = true;
            }
        }

        if (!$isValid) {
            $expectedType = $info['type'];
            throw new Exceptions\InvalidPropertyTypeException($name, $expectedType, $actualType);
        }
    }
private static function ensurePropertyType($class, $name, $value)
    {
        $isValid = false;
        $info = self::propertyInfo($class, $name);
        $actualType = self::getActualType($value);
        $valid = explode('|', $info['type']);

        foreach ($valid as $check) {
            if ($check !== 'any' && \DTS\eBaySDK\checkPropertyType($check)) {
                if ($check === $actualType || 'array' === $actualType) {
                    return;
                }
                $isValid = false;
            } else {
                $isValid = true;
            }
        }

        if (!$isValid) {
            $expectedType = $info['type'];
            throw new Exceptions\InvalidPropertyTypeException($name, $expectedType, $actualType);
        }
    }
Determines if the value is the correct type to assign to a property.

@param string $class The name of the class that we are checking for.
@param mixed $name The property name.
@param mixed $value The value to check the type of.

@throws \DTS\eBaySDK\Exceptions\InvalidPropertyTypeException If the value is the wrong type for the property.