From 173fa9af417a2218c43501275c380ee90d8a82d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Thu, 11 Jul 2024 08:48:30 +0900 Subject: [PATCH 1/4] fix: php-8.4 deprecation --- lib/promise-adapter/src/Adapter/GuzzleHttpPromiseAdapter.php | 2 +- lib/promise-adapter/src/Adapter/ReactPromiseAdapter.php | 2 +- .../src/Adapter/WebonyxGraphQLSyncPromiseAdapter.php | 2 +- lib/promise-adapter/src/PromiseAdapterInterface.php | 2 +- src/DataLoader.php | 2 +- tests/AbuseTest.php | 2 +- tests/DataLoadTest.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/promise-adapter/src/Adapter/GuzzleHttpPromiseAdapter.php b/lib/promise-adapter/src/Adapter/GuzzleHttpPromiseAdapter.php index 597eded..2b126ea 100644 --- a/lib/promise-adapter/src/Adapter/GuzzleHttpPromiseAdapter.php +++ b/lib/promise-adapter/src/Adapter/GuzzleHttpPromiseAdapter.php @@ -29,7 +29,7 @@ class GuzzleHttpPromiseAdapter implements PromiseAdapterInterface * * @return Promise */ - public function create(&$resolve = null, &$reject = null, callable $canceller = null) + public function create(&$resolve = null, &$reject = null, ?callable $canceller = null) { $queue = Utils::queue(); $promise = new Promise([$queue, 'run'], $canceller); diff --git a/lib/promise-adapter/src/Adapter/ReactPromiseAdapter.php b/lib/promise-adapter/src/Adapter/ReactPromiseAdapter.php index 5be2069..db247c0 100644 --- a/lib/promise-adapter/src/Adapter/ReactPromiseAdapter.php +++ b/lib/promise-adapter/src/Adapter/ReactPromiseAdapter.php @@ -29,7 +29,7 @@ class ReactPromiseAdapter implements PromiseAdapterInterface * * @return Promise */ - public function create(&$resolve = null, &$reject = null, callable $canceller = null) + public function create(&$resolve = null, &$reject = null, ?callable $canceller = null) { $deferred = new Deferred($canceller); diff --git a/lib/promise-adapter/src/Adapter/WebonyxGraphQLSyncPromiseAdapter.php b/lib/promise-adapter/src/Adapter/WebonyxGraphQLSyncPromiseAdapter.php index 664ffe5..849ec60 100644 --- a/lib/promise-adapter/src/Adapter/WebonyxGraphQLSyncPromiseAdapter.php +++ b/lib/promise-adapter/src/Adapter/WebonyxGraphQLSyncPromiseAdapter.php @@ -55,7 +55,7 @@ public function setWebonyxPromiseAdapter(SyncPromiseAdapter $webonyxPromiseAdapt /** * {@inheritdoc} */ - public function create(&$resolve = null, &$reject = null, callable $canceller = null) + public function create(&$resolve = null, &$reject = null, ?callable $canceller = null) { $promise = $this->webonyxPromiseAdapter->create(function ($res, $rej) use (&$resolve, &$reject) { $resolve = $res; diff --git a/lib/promise-adapter/src/PromiseAdapterInterface.php b/lib/promise-adapter/src/PromiseAdapterInterface.php index cf67a01..eedc62d 100644 --- a/lib/promise-adapter/src/PromiseAdapterInterface.php +++ b/lib/promise-adapter/src/PromiseAdapterInterface.php @@ -25,7 +25,7 @@ interface PromiseAdapterInterface * * @return TPromise a Promise */ - public function create(&$resolve = null, &$reject = null, callable $canceller = null); + public function create(&$resolve = null, &$reject = null, ?callable $canceller = null); /** * Creates a full filed Promise for a value if the value is not a promise. diff --git a/src/DataLoader.php b/src/DataLoader.php index 2e17b63..c66ae22 100644 --- a/src/DataLoader.php +++ b/src/DataLoader.php @@ -45,7 +45,7 @@ class DataLoader implements DataLoaderInterface */ private $promiseAdapter; - public function __construct(callable $batchLoadFn, PromiseAdapterInterface $promiseFactory, Option $options = null) + public function __construct(callable $batchLoadFn, PromiseAdapterInterface $promiseFactory, ?Option $options = null) { $this->batchLoadFn = $batchLoadFn; $this->promiseAdapter = $promiseFactory; diff --git a/tests/AbuseTest.php b/tests/AbuseTest.php index 63b4756..c163fa8 100644 --- a/tests/AbuseTest.php +++ b/tests/AbuseTest.php @@ -124,7 +124,7 @@ public function testAwaitWithoutNoInstance() * @param callable $batchLoadFn * @return DataLoader */ - private static function idLoader(callable $batchLoadFn = null) + private static function idLoader(?callable $batchLoadFn = null) { if (null === $batchLoadFn) { $batchLoadFn = function ($keys) { diff --git a/tests/DataLoadTest.php b/tests/DataLoadTest.php index b01cb77..fd17e01 100644 --- a/tests/DataLoadTest.php +++ b/tests/DataLoadTest.php @@ -894,7 +894,7 @@ private static function eventLoader() }); } - private static function idLoader(Option $options = null, callable $batchLoadFnCallBack = null) + private static function idLoader(?Option $options = null, ?callable $batchLoadFnCallBack = null) { $loadCalls = new \ArrayObject(); if (null === $batchLoadFnCallBack) { From c9155089f59c3b223ae0ce2958a51b307d33471d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Thu, 11 Jul 2024 08:49:47 +0900 Subject: [PATCH 2/4] ci: add new versions of php --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb8259f..db3136b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,9 +17,14 @@ jobs: php-version: - "8.1" - "8.2" + - "8.3" + - "8.4" dependencies: - "lowest" - "highest" + exclude: + - php-version: "8.4" + dependencies: "lowest" steps: - name: "Checkout" From 04db7b2ce89be7be86ecaf3a725b7a300c63b5d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Thu, 11 Jul 2024 08:50:29 +0900 Subject: [PATCH 3/4] chore: use latest version og github actions --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index db3136b..66346d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" with: fetch-depth: 2 @@ -40,7 +40,7 @@ jobs: ini-values: "zend.assertions=1" - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v2" + uses: "ramsey/composer-install@v3" with: dependency-versions: "${{ matrix.dependencies }}" @@ -48,7 +48,7 @@ jobs: run: "vendor/bin/phpunit --coverage-clover=coverage.xml" - name: "Upload coverage file" - uses: "actions/upload-artifact@v2" + uses: "actions/upload-artifact@v4" with: name: "phpunit-${{ matrix.dependencies }}-${{ matrix.php-version }}.coverage" path: "coverage.xml" @@ -61,17 +61,17 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" with: fetch-depth: 2 - name: "Download coverage files" - uses: "actions/download-artifact@v2" + uses: "actions/download-artifact@v4" with: path: "reports" - name: "Upload to Codecov" - uses: "codecov/codecov-action@v1" + uses: "codecov/codecov-action@v3" with: directory: reports @@ -86,7 +86,7 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" - name: "Install PHP" uses: "shivammathur/setup-php@v2" @@ -96,7 +96,7 @@ jobs: tools: "cs2pr" - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v2" + uses: "ramsey/composer-install@v3" - name: "Install php-cs-fixer" run: composer require "friendsofphp/php-cs-fixer:^3.23" From c4619a330cea24edd867aa1479ef02ab91cdd8ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A6=E7=94=B0=20=E6=86=B2=E5=A4=AA=E9=83=8E?= Date: Tue, 3 Dec 2024 22:08:33 +0900 Subject: [PATCH 4/4] fix: implicit nullable missed in `__construct` --- .../src/Adapter/WebonyxGraphQLSyncPromiseAdapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/promise-adapter/src/Adapter/WebonyxGraphQLSyncPromiseAdapter.php b/lib/promise-adapter/src/Adapter/WebonyxGraphQLSyncPromiseAdapter.php index 849ec60..dbf8a65 100644 --- a/lib/promise-adapter/src/Adapter/WebonyxGraphQLSyncPromiseAdapter.php +++ b/lib/promise-adapter/src/Adapter/WebonyxGraphQLSyncPromiseAdapter.php @@ -30,7 +30,7 @@ class WebonyxGraphQLSyncPromiseAdapter implements PromiseAdapterInterface */ private $webonyxPromiseAdapter; - public function __construct(SyncPromiseAdapter $webonyxPromiseAdapter = null) + public function __construct(?SyncPromiseAdapter $webonyxPromiseAdapter = null) { $webonyxPromiseAdapter = $webonyxPromiseAdapter?:new SyncPromiseAdapter(); $this->setWebonyxPromiseAdapter($webonyxPromiseAdapter);