From da21a008ab74a8b6b0badc8843e912bbd512a258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dezs=C5=91=20BICZ=C3=93?= Date: Thu, 19 Oct 2023 09:11:16 +0200 Subject: [PATCH 1/2] Add union type to suppress deprecation warning --- src/ClientInterface.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ClientInterface.php b/src/ClientInterface.php index bfe7f7ea..1194d452 100644 --- a/src/ClientInterface.php +++ b/src/ClientInterface.php @@ -19,7 +19,6 @@ namespace Apigee\Edge; use Apigee\Edge\HttpClient\Utility\JournalInterface; -use Http\Message\UriFactory; use Psr\Http\Client\ClientInterface as HttpClient; use Psr\Http\Message\ResponseInterface; @@ -75,8 +74,12 @@ public function getJournal(): JournalInterface; /** * Returns the URI factory used by the Client. + * + * @return \Http\Message\UriFactory|\Psr\Http\Message\UriFactoryInterface + * + * @todo Restore native return type as \Psr\Http\Message\UriFactoryInterface in 4.0.0. */ - public function getUriFactory(): UriFactory; + public function getUriFactory(); /** * Returns the version of the API client. From e7f67df2436aa29593305acfdb14258a883e8fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dezs=C5=91=20BICZ=C3=93?= Date: Wed, 8 Nov 2023 13:19:45 +0100 Subject: [PATCH 2/2] Fix valid complain by PSALM InvalidArgument: Argument 2 of Http\Promise\Promise::then expects callable(Exception):mixed|null, but impure-Closure(Http\Client\Exception):mixed provided --- src/HttpClient/Plugin/RetryOauthAuthenticationPlugin.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/HttpClient/Plugin/RetryOauthAuthenticationPlugin.php b/src/HttpClient/Plugin/RetryOauthAuthenticationPlugin.php index f1a2f909..30863d99 100644 --- a/src/HttpClient/Plugin/RetryOauthAuthenticationPlugin.php +++ b/src/HttpClient/Plugin/RetryOauthAuthenticationPlugin.php @@ -20,8 +20,8 @@ use Apigee\Edge\Exception\OauthAccessTokenAuthenticationException; use Apigee\Edge\HttpClient\Plugin\Authentication\AbstractOauth; +use Exception; use Http\Client\Common\Plugin; -use Http\Client\Exception; use Http\Promise\Promise; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -62,9 +62,8 @@ public function handleRequest(RequestInterface $request, callable $next, callabl // Mark access token as expired and with that ensure that the authentication plugin gets a new // access token. $this->auth->getTokenStorage()->markExpired(); - $promise = $first($request); - return $promise->wait(); + return $first($request)->wait(); } throw $exception;