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

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

        return $new;
    }
public function withQuery ( $ query ) { $ new = clone $ this ; try { $ new -> setQuery ( $ query ) ; } catch ( InvalidArgumentException $ ex ) { throw new InvalidArgumentException ( 'Invalid query provided.' , null , $ ex ) ; } return $ new ; }
Return an instance with the provided query string.

@param string $query The query string to use with the new instance

@throws \InvalidArgumentException If invalid query provided

@return Uri The instance with the provided query string
Return an instance with the provided query string .