private function validateMultipleTypes($value, array $types, ValidationField $field) {
        trigger_error('Multiple schema types are deprecated.', E_USER_DEPRECATED);

        // First check for an exact type match.
        switch (gettype($value)) {
            case 'boolean':
                if (in_array('boolean', $types)) {
                    $singleType = 'boolean';
                }
                break;
            case 'integer':
                if (in_array('integer', $types)) {
                    $singleType = 'integer';
                } elseif (in_array('number', $types)) {
                    $singleType = 'number';
                }
                break;
            case 'double':
                if (in_array('number', $types)) {
                    $singleType = 'number';
                } elseif (in_array('integer', $types)) {
                    $singleType = 'integer';
                }
                break;
            case 'string':
                if (in_array('datetime', $types) && preg_match(self::$DATE_REGEX, $value)) {
                    $singleType = 'datetime';
                } elseif (in_array('string', $types)) {
                    $singleType = 'string';
                }
                break;
            case 'array':
                if (in_array('array', $types) && in_array('object', $types)) {
                    $singleType = isset($value[0]) || empty($value) ? 'array' : 'object';
                } elseif (in_array('object', $types)) {
                    $singleType = 'object';
                } elseif (in_array('array', $types)) {
                    $singleType = 'array';
                }
                break;
            case 'NULL':
                if (in_array('null', $types)) {
                    $singleType = $this->validateSingleType($value, 'null', $field);
                }
                break;
        }
        if (!empty($singleType)) {
            return $this->validateSingleType($value, $singleType, $field);
        }

        // Clone the validation field to collect errors.
        $typeValidation = new ValidationField(new Validation(), $field->getField(), '', '', $field->getOptions());

        // Try and validate against each type.
        foreach ($types as $type) {
            $result = $this->validateSingleType($value, $type, $typeValidation);
            if (Invalid::isValid($result)) {
                return $result;
            }
        }

        // Since we got here the value is invalid.
        $field->merge($typeValidation->getValidation());
        return Invalid::value();
    }