code: private function setPort($port)
      {
          if (null === $port) {
              $this->port = $port;
  
              return;
          }
  
          if (is_int($port)
              && $port >= self::$validPortRange[0]
              && $port <= self::$validPortRange[1]
              && !in_array($port, self::$invalidPorts)
          ) {
              $this->port = $port;
          } else {
              throw new \InvalidArgumentException("Invalid port");
          }
      }
docs: @param int|null $port
  
  @throws \InvalidArgumentException