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");
        }
    }
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");
        }
    }
@param int|null $port

@throws \InvalidArgumentException