Skip to content

Commit

Permalink
Upgrade Guzzle Promises Function API to Static API
Browse files Browse the repository at this point in the history
Guzzle Promises:
A static API was first introduced in 1.4.0, in order to mitigate problems with functions conflicting between global and local copies of the package. The function API was removed in 2.0.0.

https://github.com/guzzle/promises#upgrading-from-function-api
  • Loading branch information
DimionX authored Jun 7, 2023
1 parent add74da commit 5f08625
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Ganesha/GuzzleMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __invoke(callable $handler): \Closure
$serviceName = $this->serviceNameExtractor->extract($request, $options);

if (!$this->ganesha->isAvailable($serviceName)) {
return \GuzzleHttp\Promise\rejection_for(
return \GuzzleHttp\Promise\Create::rejectionFor(
new RejectedException(
sprintf('"%s" is not available', $serviceName)
)
Expand All @@ -62,11 +62,11 @@ function ($value) use ($serviceName) {
} else {
$this->ganesha->success($serviceName);
}
return \GuzzleHttp\Promise\promise_for($value);
return \GuzzleHttp\Promise\Create::promiseFor($value);
},
function ($reason) use ($serviceName) {
$this->ganesha->failure($serviceName);
return \GuzzleHttp\Promise\rejection_for($reason);
return \GuzzleHttp\Promise\Create::rejectionFor($reason);
}
);
};
Expand Down

0 comments on commit 5f08625

Please sign in to comment.