code: public function setType(?string $type)
      {
          if (null !== $type && $this->getTypes() && !in_array($type, $this->getTypes(), true)) {
              throw new DomainException('Type does not exist.');
          }
  
          $this->type = $type;
  
          return $this;
      }
docs: Set type
  
  @param string $type
  @return object