protected function validateObject() { if (!$this->product || !$this->product instanceof Product) { throw new ValidationError('Basket items must be instance of Product'); } }