src/Http/Uri.php
public function withQuery($query)
    {
        if (!is_string($query) && !is_array($query)) {
            throw new \InvalidArgumentException(
                'Query string must be a string or array'
            );
        }

        if (is_array($query)) {
            $query = http_build_query($query);
        }

        $this->query = ltrim($query, '?');

        return $this;
    }
public function withQuery($query)
    {
        if (!is_string($query) && !is_array($query)) {
            throw new \InvalidArgumentException(
                'Query string must be a string or array'
            );
        }

        if (is_array($query)) {
            $query = http_build_query($query);
        }

        $this->query = ltrim($query, '?');

        return $this;
    }
{@inheritdoc}