src/Url.php
private static function myValidateQueryString(?string $queryString, ?string &$error): bool
    {
        if ($queryString === null) {
            return true;
        }

        if (preg_match('/[^0-9a-zA-Z._~!\$&\'()*\+,;=:@\[\]\/\?%-]/', $queryString, $matches)) {
            $error = 'Query string "' . $queryString . '" contains invalid character "' . $matches[0] . '".';

            return false;
        }

        return true;
    }
private static function myValidateQueryString(?string $queryString, ?string &$error): bool
    {
        if ($queryString === null) {
            return true;
        }

        if (preg_match('/[^0-9a-zA-Z._~!\$&\'()*\+,;=:@\[\]\/\?%-]/', $queryString, $matches)) {
            $error = 'Query string "' . $queryString . '" contains invalid character "' . $matches[0] . '".';

            return false;
        }

        return true;
    }
private static function myValidateQueryString ( ? string $ queryString , ? string & $ error ) : bool { if ( $ queryString === null ) { return true ; } if ( preg_match ( '/[^0-9a-zA-Z._~!\$&\'()*\+,;=:@\[\]\/\?%-]/' , $ queryString , $ matches ) ) { $ error = 'Query string "' . $ queryString . '" contains invalid character "' . $ matches [ 0 ] . '".' ; return false ; } return true ; }
Validates a query string.

@param string|null $queryString The query string.
@param string      $error       The error text if validation was not successful, undefined otherwise.

@return bool True if validation was successful, false otherwise.
Validates a query string .