src/Uri.php
public function withPort($port)
    {
        $new = clone $this;
        try {
            $new->setPort($port);
        } catch (InvalidArgumentException $ex) {
            throw new InvalidArgumentException('Invalid port provided.', null, $ex);
        }

        return $new;
    }
public function withPort($port)
    {
        $new = clone $this;
        try {
            $new->setPort($port);
        } catch (InvalidArgumentException $ex) {
            throw new InvalidArgumentException('Invalid port provided.', null, $ex);
        }

        return $new;
    }
public function withPort ( $ port ) { $ new = clone $ this ; try { $ new -> setPort ( $ port ) ; } catch ( InvalidArgumentException $ ex ) { throw new InvalidArgumentException ( 'Invalid port provided.' , null , $ ex ) ; } return $ new ; }
Return an instance with the provided port.
A null value provided for the port is equivalent to removing the port
information.

@param null|int $port The port to use with the new instance; a null value
removes the port information

@throw \InvalidArgumentException If invalid port provided

@return Uri The instance with the provided port
Return an instance with the provided port . A null value provided for the port is equivalent to removing the port information .