code: public function setDataValidation(DataValidation $pDataValidation = null)
      {
          if (!isset($this->parent)) {
              throw new Exception('Cannot set data validation for cell that is not bound to a worksheet');
          }
  
          $this->getWorksheet()->setDataValidation($this->getCoordinate(), $pDataValidation);
  
          return $this->updateInCollection();
      }
docs: Set Data validation rules.
  
  @param DataValidation $pDataValidation
  
  @throws Exception
  
  @return Cell