src/Annotations/AbstractAnnotation.php
private function validateType($type, $value): bool
    {
        if (substr($type, 0, 1) === '[' && substr($type, -1) === ']') { // Array of a specified type?
            if ($this->validateType('array', $value) === false) {
                return false;
            }
            $itemType = substr($type, 1, -1);
            foreach ($value as $i => $item) {
                if ($this->validateType($itemType, $item) === false) {
                    return false;
                }
            }
            return true;
        }

        if (is_subclass_of($type, AbstractAnnotation::class)) {
            $type = 'object';
        }

        return $this->validateDefaultTypes($type, $value);
    }
private function validateType($type, $value): bool
    {
        if (substr($type, 0, 1) === '[' && substr($type, -1) === ']') { // Array of a specified type?
            if ($this->validateType('array', $value) === false) {
                return false;
            }
            $itemType = substr($type, 1, -1);
            foreach ($value as $i => $item) {
                if ($this->validateType($itemType, $item) === false) {
                    return false;
                }
            }
            return true;
        }

        if (is_subclass_of($type, AbstractAnnotation::class)) {
            $type = 'object';
        }

        return $this->validateDefaultTypes($type, $value);
    }
private function validateType ( $ type , $ value ) : bool { if ( substr ( $ type , 0 , 1 ) === '[' && substr ( $ type , - 1 ) === ']' ) { // Array of a specified type? if ( $ this -> validateType ( 'array' , $ value ) === false ) { return false ; } $ itemType = substr ( $ type , 1 , - 1 ) ; foreach ( $ value as $ i => $ item ) { if ( $ this -> validateType ( $ itemType , $ item ) === false ) { return false ; } } return true ; } if ( is_subclass_of ( $ type , AbstractAnnotation :: class ) ) { $ type = 'object' ; } return $ this -> validateDefaultTypes ( $ type , $ value ) ; }
Validates the matching of the property value to a annotation type

@param string $type  The annotations property type
@param mixed  $value The property value

@return bool
@throws \Exception
Validates the matching of the property value to a annotation type