/** * {@inheritdoc} */ public function set($key, $value) : CollectionInterface { $this->validate($this->type, [$value]); return new self($this->type, parent::set($key, $value)->toPrimitive()); }