protected function marshalPort($port): ? int
    {
        if ( null === $port ) {
            return null;
        }

        $port = (int) $port;

        if ( 0 > $port || 65535 < $port ) {
            throw new UriException(
                sprintf('Invalid port: %s, value must be between 0 and 65535', $port)
            );
        }

        return $port;
    }
protected function marshalPort($port): ? int
    {
        if ( null === $port ) {
            return null;
        }

        $port = (int) $port;

        if ( 0 > $port || 65535 < $port ) {
            throw new UriException(
                sprintf('Invalid port: %s, value must be between 0 and 65535', $port)
            );
        }

        return $port;
    }
protected function marshalPort ( $ port ) : ? int { if ( null === $ port ) { return null ; } $ port = ( int ) $ port ; if ( 0 > $ port || 65535 < $ port ) { throw new UriException ( sprintf ( 'Invalid port: %s, value must be between 0 and 65535' , $ port ) ) ; } return $ port ; }
marshals the port.

@param $port
@return int|null
@throws UriException
marshals the port .