From 03c502cfa7c1d82dd8cfc314a3c70f2840593a58 Mon Sep 17 00:00:00 2001 From: Ben Corlett Date: Mon, 5 Jul 2021 19:45:03 +1000 Subject: [PATCH] Remove deprecated Guzzle function call. The `GuzzleHttp\Psr7\uri_for` function is deprecated and removed in Guzzle 7.2. Where available `GuzzleHttp\Psr7\Utils::uriFor` is used instead. Given we support Guzzle 6 and 7, both the method and function call are required to be supported. Fixes #134. --- src/Signature/EncodesUrl.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Signature/EncodesUrl.php b/src/Signature/EncodesUrl.php index 5aab03e..a327cb6 100644 --- a/src/Signature/EncodesUrl.php +++ b/src/Signature/EncodesUrl.php @@ -4,6 +4,7 @@ use GuzzleHttp\Psr7; use GuzzleHttp\Psr7\Uri; +use function GuzzleHttp\Psr7\uri_for; use Psr\Http\Message\UriInterface; trait EncodesUrl @@ -17,6 +18,11 @@ trait EncodesUrl */ protected function createUrl($uri) { + if (method_exists(Psr7\Utils::class, 'uriFor')) { + return Psr7\Utils::uriFor($uri); + } + + // Deprecated, removed in Guzzle 7.2 return Psr7\uri_for($uri); }