Skip to content

Commit

Permalink
Merge pull request #139 from php-http/guzzle-psr7-2
Browse files Browse the repository at this point in the history
support guzzle psr7 version 2
  • Loading branch information
dbu authored May 24, 2021
2 parents fb0dbce + 11dd897 commit 887734d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ jobs:
uses: actions/checkout@v2

- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
uses: docker://oskarstark/php-cs-fixer-ga:2.19.0
with:
args: --dry-run --diff-format udiff
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.11.1] - 2021-05-24

- Support GuzzleHttp/Psr7 version 2.0 in the (deprecated) GuzzleUriFactory.

## [1.11.0] - 2020-02-01

- Migrated from `zendframework/zend-diactoros` to `laminas/laminas-diactoros`.
Expand Down
27 changes: 11 additions & 16 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ parameters:
path: src/Authentication/Header.php

-
message: "#^Property Http\\\\Message\\\\Authentication\\\\QueryParam\\:\\:\\$params type has no value type specified in iterable type array\\.$#"
message: "#The Http\\\\Message\\\\Authentication\\\\Matching class is deprecated since version 1.2 and will be removed in 2.0.#"
count: 1
path: src/Authentication/QueryParam.php
path: src/Authentication/Matching.php

-
message: "#^Method Http\\\\Message\\\\Authentication\\\\QueryParam\\:\\:__construct\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
message: "#^Property Http\\\\Message\\\\Authentication\\\\QueryParam\\:\\:\\$params type has no value type specified in iterable type array\\.$#"
count: 1
path: src/Authentication/QueryParam.php

-
message: "#^Parameter \\#2 \\$prefix of function http_build_query expects string, null given\\.$#"
message: "#^Method Http\\\\Message\\\\Authentication\\\\QueryParam\\:\\:__construct\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#"
count: 1
path: src/Authentication/QueryParam.php

Expand All @@ -46,7 +46,7 @@ parameters:
path: src/Cookie.php

-
message: "#^Parameter \\#2 \\$str2 of function strcasecmp expects string, string\\|null given\\.$#"
message: "#^Parameter \\#2 \\$string2 of function strcasecmp expects string, string\\|null given\\.$#"
count: 1
path: src/Cookie.php

Expand Down Expand Up @@ -76,7 +76,7 @@ parameters:
path: src/Cookie.php

-
message: "#^Parameter \\#1 \\$str of function rtrim expects string, string\\|null given\\.$#"
message: "#^Parameter \\#1 \\$string of function rtrim expects string, string\\|null given\\.$#"
count: 1
path: src/Cookie.php

Expand Down Expand Up @@ -160,16 +160,6 @@ parameters:
count: 2
path: src/Encoding/Filter/Chunk.php

-
message: "#^Parameter \\#2 \\$bucket of function stream_bucket_append expects object, resource given\\.$#"
count: 2
path: src/Encoding/Filter/Chunk.php

-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: src/Encoding/Filter/Chunk.php

-
message: "#^Method Http\\\\Message\\\\Encoding\\\\FilteredStream\\:\\:fill\\(\\) has no return typehint specified\\.$#"
count: 1
Expand Down Expand Up @@ -215,6 +205,11 @@ parameters:
count: 1
path: src/MessageFactory/SlimMessageFactory.php

-
message: "#The Http\\\\Message\\\\RequestMatcher\\\\RegexRequestMatcher class is deprecated since version 1.2 and will be removed in 2.0.#"
count: 1
path: src/RequestMatcher/RegexRequestMatcher.php

-
message: "#^Property Http\\\\Message\\\\RequestMatcher\\\\RequestMatcher\\:\\:\\$methods type has no value type specified in iterable type array\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion src/Authentication/QueryParam.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function authenticate(RequestInterface $request)

$params = array_merge($params, $this->params);

$query = http_build_query($params, null, '&');
$query = http_build_query($params, '', '&');

$uri = $uri->withQuery($query);

Expand Down
9 changes: 7 additions & 2 deletions src/UriFactory/GuzzleUriFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace Http\Message\UriFactory;

use GuzzleHttp\Psr7;
use function GuzzleHttp\Psr7\uri_for;
use GuzzleHttp\Psr7\Utils;
use Http\Message\UriFactory;

/**
Expand All @@ -19,6 +20,10 @@ final class GuzzleUriFactory implements UriFactory
*/
public function createUri($uri)
{
return Psr7\uri_for($uri);
if (class_exists(Utils::class)) {
return Utils::uriFor($uri);
}

return uri_for($uri);
}
}

0 comments on commit 887734d

Please sign in to comment.