From e828df85bfa6d0aa2fb9cb8df8250c38f67cef04 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 27 Aug 2025 09:22:07 +0200 Subject: [PATCH 1/4] Use str_increment() to fix PHP 8.5 deprecation --- src/CompositeCancellation.php | 3 ++- src/Internal/Cancellable.php | 3 ++- src/Internal/FutureState.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/CompositeCancellation.php b/src/CompositeCancellation.php index 9e428873..4aa7f497 100644 --- a/src/CompositeCancellation.php +++ b/src/CompositeCancellation.php @@ -69,7 +69,8 @@ public function __destruct() public function subscribe(\Closure $callback): string { - $id = $this->nextId++; + $id = $this->nextId; + \PHP_VERSION_ID >= 80300 ? $this->nextId = \str_increment($this->nextId) : ++$this->nextId; if ($this->exception) { EventLoop::queue($callback, $this->exception); diff --git a/src/Internal/Cancellable.php b/src/Internal/Cancellable.php index 2a4b0c78..011ce4c4 100644 --- a/src/Internal/Cancellable.php +++ b/src/Internal/Cancellable.php @@ -58,7 +58,8 @@ private function getException(): CancelledException public function subscribe(\Closure $callback): string { - $id = $this->nextId++; + $id = $this->nextId; + \PHP_VERSION_ID >= 80300 ? $this->nextId = \str_increment($this->nextId) : ++$this->nextId; if ($this->requested) { $exception = $this->getException(); diff --git a/src/Internal/FutureState.php b/src/Internal/FutureState.php index 1f63cfb9..492466ae 100644 --- a/src/Internal/FutureState.php +++ b/src/Internal/FutureState.php @@ -67,7 +67,8 @@ public function __destruct() */ public function subscribe(\Closure $callback): string { - $id = self::$nextId++; + $id = self::$nextId; + \PHP_VERSION_ID >= 80300 ? $this->nextId = \str_increment($this->nextId) : ++$this->nextId; $this->handled = true; // Even if unsubscribed later, consider the future handled. From 1ab8314b8eba93f16c7532b3b9d9e6b206126a3a Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Wed, 27 Aug 2025 11:56:33 +0200 Subject: [PATCH 2/4] Update GitHub action versions --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebb67b37..ce2dbbf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: git config --global core.eol lf - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v5 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -53,7 +53,7 @@ jobs: run: echo "::set-output name=dir::$(composer config cache-dir)" - name: Cache dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}-${{ matrix.composer-flags }} From 191810aedd1ee0113093a09e04107293173adc55 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Wed, 27 Aug 2025 13:02:24 +0200 Subject: [PATCH 3/4] Fix build --- src/Internal/FutureState.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Internal/FutureState.php b/src/Internal/FutureState.php index 492466ae..4d3c1769 100644 --- a/src/Internal/FutureState.php +++ b/src/Internal/FutureState.php @@ -68,7 +68,7 @@ public function __destruct() public function subscribe(\Closure $callback): string { $id = self::$nextId; - \PHP_VERSION_ID >= 80300 ? $this->nextId = \str_increment($this->nextId) : ++$this->nextId; + \PHP_VERSION_ID >= 80300 ? self::$nextId = \str_increment(self::$nextId) : ++self::$nextId; $this->handled = true; // Even if unsubscribed later, consider the future handled. From 569fdbb605449f4683353a82ee14da387028c287 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Wed, 27 Aug 2025 23:39:05 +0200 Subject: [PATCH 4/4] Ignore psalm error for str_increment --- psalm.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/psalm.xml b/psalm.xml index eeb587fe..5e8a67c5 100644 --- a/psalm.xml +++ b/psalm.xml @@ -18,6 +18,12 @@ + + + + + +