Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e5d878c

Browse files
Fix Guzzle compatibility issues
1 parent 9dfa8be commit e5d878c

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
"require": {
2727
"php": ">=5.6.0",
2828
"cloudinary/transformation-builder-sdk": "^1",
29-
"guzzlehttp/guzzle": "^6|^7",
29+
"guzzlehttp/guzzle": "^6.5.8|^7.4.5",
30+
"guzzlehttp/promises": "^1.5.3|^2.0",
31+
"guzzlehttp/psr7": "^1.9.1|^2.5",
3032
"teapot/status-code": "^1|^2",
3133
"ext-json": "*",
3234
"monolog/monolog": "^1|^2|^3",

src/Api/ApiClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use Cloudinary\Utils;
2121
use Exception;
2222
use GuzzleHttp\Client;
23-
use GuzzleHttp\Promise;
23+
use GuzzleHttp\Promise\Create;
2424
use GuzzleHttp\Promise\PromiseInterface;
2525
use GuzzleHttp\Psr7\LimitStream;
2626
use InvalidArgumentException;
@@ -355,13 +355,13 @@ private function postLargeFileAsync($endPoint, $fileHandle, $parameters, $option
355355
]
356356
);
357357

358-
return Promise\rejection_for($e);
358+
return Create::rejectionFor($e);
359359
}
360360

361361
ArrayUtils::addNonEmptyFromOther($parameters, 'public_id', $uploadResult);
362362
}
363363

364-
return Promise\promise_for($uploadResult);
364+
return Create::promiseFor($uploadResult);
365365
}
366366

367367
/**

src/Api/BaseApiClient.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
use Exception;
2929
use GuzzleHttp\Client;
3030
use GuzzleHttp\Exception\ClientException;
31-
use GuzzleHttp\Promise;
31+
use GuzzleHttp\Promise\Create;
3232
use GuzzleHttp\Promise\PromiseInterface;
3333
use InvalidArgumentException;
3434
use JsonSerializable;
@@ -330,7 +330,7 @@ function (ResponseInterface $response) {
330330
['statusCode' => $response->getStatusCode()]
331331
);
332332
try {
333-
return Promise\promise_for($this->handleApiResponse($response));
333+
return Create::promiseFor($this->handleApiResponse($response));
334334
} catch (Exception $e) {
335335
$this->getLogger()->critical(
336336
'Async request failed',
@@ -340,7 +340,7 @@ function (ResponseInterface $response) {
340340
]
341341
);
342342

343-
return Promise\rejection_for($e);
343+
return Create::rejectionFor($e);
344344
}
345345
},
346346
function (Exception $error) {
@@ -352,10 +352,10 @@ function (Exception $error) {
352352
]
353353
);
354354
if ($error instanceof ClientException) {
355-
return Promise\rejection_for($this->handleApiResponse($error->getResponse()));
355+
return Create::rejectionFor($this->handleApiResponse($error->getResponse()));
356356
}
357357

358-
return Promise\rejection_for($error);
358+
return Create::rejectionFor($error);
359359
}
360360
);
361361
}

0 commit comments

Comments
 (0)