src/Mpociot/Reflection/DocBlock/Type/Collection.php
public function add($type)
    {
        if (!is_string($type)) {
            throw new \InvalidArgumentException(
                'A type should be represented by a string, received: '
                .var_export($type, true)
            );
        }

        // separate the type by the OR operator
        $type_parts = explode(self::OPERATOR_OR, $type);
        foreach ($type_parts as $part) {
            $expanded_type = $this->expand($part);
            if ($expanded_type) {
                $this[] = $expanded_type;
            }
        }
    }
public function add($type)
    {
        if (!is_string($type)) {
            throw new \InvalidArgumentException(
                'A type should be represented by a string, received: '
                .var_export($type, true)
            );
        }

        // separate the type by the OR operator
        $type_parts = explode(self::OPERATOR_OR, $type);
        foreach ($type_parts as $part) {
            $expanded_type = $this->expand($part);
            if ($expanded_type) {
                $this[] = $expanded_type;
            }
        }
    }
public function add ( $ type ) { if ( ! is_string ( $ type ) ) { throw new \ InvalidArgumentException ( 'A type should be represented by a string, received: ' . var_export ( $ type , true ) ) ; } // separate the type by the OR operator $ type_parts = explode ( self :: OPERATOR_OR , $ type ) ; foreach ( $ type_parts as $ part ) { $ expanded_type = $ this -> expand ( $ part ) ; if ( $ expanded_type ) { $ this [ ] = $ expanded_type ; } } }
Adds a new type to the collection and expands it if it contains a
relative namespace.

If a class in the type contains a relative namespace than this collection
will try to expand that into a FQCN.

@param string $type A 'Type' as defined in the phpDocumentor
documentation.

@throws \InvalidArgumentException if a non-string argument is passed.

@see http://phpdoc.org/docs/latest/for-users/types.html for the
definition of a type.

@return void
Adds a new type to the collection and expands it if it contains a relative namespace .