Skip to content

Commit

Permalink
Merge branch 'master' into 15
Browse files Browse the repository at this point in the history
  • Loading branch information
mcg-web authored Aug 25, 2023
2 parents be58b89 + 6d3a5a1 commit dc5ef19
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
php-version:
- "8.0"
- "8.1"
- "8.2"
dependencies:
- "lowest"
- "highest"
Expand All @@ -35,7 +36,7 @@ jobs:
ini-values: "zend.assertions=1"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "${{ matrix.dependencies }}"

Expand Down Expand Up @@ -77,7 +78,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.0"
- "8.2"

steps:
- name: "Checkout"
Expand All @@ -91,10 +92,10 @@ jobs:
tools: "cs2pr"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
uses: "ramsey/composer-install@v2"

- name: "Install php-cs-fixer"
run: composer require "friendsofphp/php-cs-fixer:^2.16"
run: composer require "friendsofphp/php-cs-fixer:^3.23"

- name: "Run php-cs-fixer"
run: "vendor/bin/php-cs-fixer fix --diff --dry-run -v"
4 changes: 2 additions & 2 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
file that was distributed with this source code.
EOF;

return PhpCsFixer\Config::create()
->setRules([
return (new PhpCsFixer\Config())
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'no_unreachable_default_argument_value' => false,
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
"php": "^8.0"
},
"require-dev": {
"guzzlehttp/promises": "^1.5.0",
"phpunit/phpunit": "^9.5.10",
"guzzlehttp/promises": "^1.5.0 || ^2.0.0",
"phpunit/php-code-coverage": "^9.2.27",
"phpunit/phpunit": "^9.6.11",
"react/promise": "^2.8.0",
"webonyx/graphql-php": "^15.0"
},
Expand Down
14 changes: 8 additions & 6 deletions lib/promise-adapter/src/Adapter/GuzzleHttpPromiseAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@

namespace Overblog\PromiseAdapter\Adapter;

use GuzzleHttp\Promise\Create;
use GuzzleHttp\Promise\FulfilledPromise;
use GuzzleHttp\Promise\Promise;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Promise\RejectedPromise;
use GuzzleHttp\Promise\Utils;
use Overblog\PromiseAdapter\PromiseAdapterInterface;

/**
Expand All @@ -29,7 +31,7 @@ class GuzzleHttpPromiseAdapter implements PromiseAdapterInterface
*/
public function create(&$resolve = null, &$reject = null, callable $canceller = null)
{
$queue = \GuzzleHttp\Promise\queue();
$queue = Utils::queue();
$promise = new Promise([$queue, 'run'], $canceller);

$reject = [$promise, 'reject'];
Expand All @@ -45,7 +47,7 @@ public function create(&$resolve = null, &$reject = null, callable $canceller =
*/
public function createFulfilled($promiseOrValue = null)
{
$promise = \GuzzleHttp\Promise\promise_for($promiseOrValue);
$promise = Create::promiseFor($promiseOrValue);

return $promise;
}
Expand All @@ -57,7 +59,7 @@ public function createFulfilled($promiseOrValue = null)
*/
public function createRejected($reason)
{
$promise = \GuzzleHttp\Promise\rejection_for($reason);
$promise = Create::rejectionFor($reason);

return $promise;
}
Expand All @@ -69,7 +71,7 @@ public function createRejected($reason)
*/
public function createAll($promisesOrValues)
{
$promise = empty($promisesOrValues) ? $this->createFulfilled($promisesOrValues) : \GuzzleHttp\Promise\all($promisesOrValues);
$promise = empty($promisesOrValues) ? $this->createFulfilled($promisesOrValues) : Utils::all($promisesOrValues);

return $promise;
}
Expand Down Expand Up @@ -107,7 +109,7 @@ public function await($promise = null, $unwrap = false)
}, function ($reason) use (&$exception) {
$exception = $reason;
});
\GuzzleHttp\Promise\queue()->run();
Utils::queue()->run();

if ($exception instanceof \Exception) {
if (!$unwrap) {
Expand All @@ -116,7 +118,7 @@ public function await($promise = null, $unwrap = false)
throw $exception;
}
} else {
\GuzzleHttp\Promise\queue()->run();
Utils::queue()->run();
}

return $resolvedValue;
Expand Down

0 comments on commit dc5ef19

Please sign in to comment.