Skip to content

Commit

Permalink
Merge pull request #53 from kamermans/guzzle-promises-v2
Browse files Browse the repository at this point in the history
feat: Guzzle Promises 2.0.0
  • Loading branch information
kamermans authored Jul 11, 2023
2 parents 1d3034c + ab9be2a commit 10b5cf2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/OAuth2Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ private function onFulfilled(RequestInterface $request, array $options, $handler
private function onRejected(RequestInterface $request, array $options, $handler)
{
return function ($reason) use ($request, $options) {
if (class_exists('\GuzzleHttp\Promise\Create')) {
return \GuzzleHttp\Promise\Create::rejectionFor($reason);
}

// As of Guzzle Promises 2.0.0, the rejection_for function is deprecated and replaced with Create::rejectionFor
return \GuzzleHttp\Promise\rejection_for($reason);
};
}
Expand Down

0 comments on commit 10b5cf2

Please sign in to comment.