Skip to content

Commit 10b5cf2

Browse files
authored
Merge pull request #53 from kamermans/guzzle-promises-v2
feat: Guzzle Promises 2.0.0
2 parents 1d3034c + ab9be2a commit 10b5cf2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/OAuth2Middleware.php

+5
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ private function onFulfilled(RequestInterface $request, array $options, $handler
8383
private function onRejected(RequestInterface $request, array $options, $handler)
8484
{
8585
return function ($reason) use ($request, $options) {
86+
if (class_exists('\GuzzleHttp\Promise\Create')) {
87+
return \GuzzleHttp\Promise\Create::rejectionFor($reason);
88+
}
89+
90+
// As of Guzzle Promises 2.0.0, the rejection_for function is deprecated and replaced with Create::rejectionFor
8691
return \GuzzleHttp\Promise\rejection_for($reason);
8792
};
8893
}

0 commit comments

Comments
 (0)