public function sort(): self
    {
        if (count($this->pairs) === count(array_count_values(array_column($this->pairs, 0)))) {
            return $this;
        }

        $pairs = array_merge(...array_values(array_reduce($this->pairs, [$this, 'reducePairs'], [])));
        if ($pairs === $this->pairs) {
            return $this;
        }

        $clone = clone $this;
        $clone->pairs = $pairs;

        return $clone;
    }
public function sort(): self
    {
        if (count($this->pairs) === count(array_count_values(array_column($this->pairs, 0)))) {
            return $this;
        }

        $pairs = array_merge(...array_values(array_reduce($this->pairs, [$this, 'reducePairs'], [])));
        if ($pairs === $this->pairs) {
            return $this;
        }

        $clone = clone $this;
        $clone->pairs = $pairs;

        return $clone;
    }
public function sort ( ) : self { if ( count ( $ this -> pairs ) === count ( array_count_values ( array_column ( $ this -> pairs , 0 ) ) ) ) { return $ this ; } $ pairs = array_merge ( ... array_values ( array_reduce ( $ this -> pairs , [ $ this , 'reducePairs' ] , [ ] ) ) ) ; if ( $ pairs === $ this -> pairs ) { return $ this ; } $ clone = clone $ this ; $ clone -> pairs = $ pairs ; return $ clone ; }
Sort the query string by offset, maintaining offset to data correlations.

This method MUST retain the state of the current instance, and return
an instance that contains the modified query

@see https://url.spec.whatwg.org/#dom-urlsearchparams-sort
Sort the query string by offset maintaining offset to data correlations .