/** * {@inheritdoc} */ public function contains($value) : bool { //avoid searching the collection if we know it's not of the same type try { $this->validate($this->type, [$value]); } catch (InvalidArgumentException $e) { return false; } return parent::contains($value); }