/** * Add element to Collection * * @author WN * @param mixed $element * @return $this * @throws InvalidElementException */ public function add($element) { try { return parent::add($element); } catch (\Exception $e) { throw new InvalidElementException('Element is not instance of ' . $this->type); } }
/** * Add element to Collection * * @author WN * @param mixed $element * @return $this * @throws InvalidElementException */ public function add($element) { try { return parent::add($element); } catch (InvalidElementException $e) { throw new InvalidElementException('Expected element to be type of ' . $this->getTypeName($this->type)); } }