src/Common/Collection/TypeCollection.php
public function add($value)
    {
        if (!$this->acceptsType($value)) {
            throw $this->doUnexpectedValueError($value);
        }

        return parent::add($value);
    }
public function add($value)
    {
        if (!$this->acceptsType($value)) {
            throw $this->doUnexpectedValueError($value);
        }

        return parent::add($value);
    }
{@inheritdoc}

@throws UnexpectedValueException