Skip to content

Commit 7d259e9

Browse files
committed
Run tests on PHP 8.4 and update test environment
1 parent 5f80055 commit 7d259e9

7 files changed

Lines changed: 21 additions & 11 deletions

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ on:
77
jobs:
88
PHPUnit:
99
name: PHPUnit (PHP ${{ matrix.php }})
10-
runs-on: ubuntu-22.04
10+
runs-on: ubuntu-24.04
1111
strategy:
1212
matrix:
1313
php:
14+
- 8.4
1415
- 8.3
1516
- 8.2
1617
- 8.1
@@ -24,7 +25,7 @@ jobs:
2425
- uses: shivammathur/setup-php@v2
2526
with:
2627
php-version: ${{ matrix.php }}
27-
coverage: xdebug
28+
coverage: ${{ matrix.php < 8.0 && 'xdebug' || 'pcov' }}
2829
ini-file: development
2930
- run: composer install
3031
- run: vendor/bin/phpunit --coverage-text
@@ -34,10 +35,11 @@ jobs:
3435

3536
PHPStan:
3637
name: PHPStan (PHP ${{ matrix.php }})
37-
runs-on: ubuntu-22.04
38+
runs-on: ubuntu-24.04
3839
strategy:
3940
matrix:
4041
php:
42+
- 8.4
4143
- 8.3
4244
- 8.2
4345
- 8.1

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"php": ">=7.1.0"
2929
},
3030
"require-dev": {
31-
"phpstan/phpstan": "1.10.39 || 1.4.10",
31+
"phpstan/phpstan": "1.12.19 || 1.4.10",
3232
"phpunit/phpunit": "^9.6 || ^7.5"
3333
},
3434
"autoload": {

phpunit.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,8 @@
2828
<ini name="assert.active" value="1" />
2929
<ini name="assert.exception" value="1" />
3030
<ini name="assert.bail" value="0" />
31+
<env name="XDEBUG_MODE" value="off"/>
32+
<ini name="pcov.enabled" value="1"/>
33+
<ini name="xdebug.mode" value="off"/>
3134
</php>
3235
</phpunit>

src/Internal/FulfilledPromise.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,14 @@ public function catch(callable $onRejected): PromiseInterface
5656
return $this;
5757
}
5858

59+
/**
60+
* @param callable(): (void|PromiseInterface<void>) $onFulfilledOrRejected
61+
* @return PromiseInterface<T>
62+
*/
5963
public function finally(callable $onFulfilledOrRejected): PromiseInterface
6064
{
6165
return $this->then(function ($value) use ($onFulfilledOrRejected): PromiseInterface {
66+
/** @var T $value */
6267
return resolve($onFulfilledOrRejected())->then(function () use ($value) {
6368
return $value;
6469
});

src/Promise.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,14 @@ public function catch(callable $onRejected): PromiseInterface
9494
});
9595
}
9696

97+
/**
98+
* @param callable(): (void|PromiseInterface<void>) $onFulfilledOrRejected
99+
* @return PromiseInterface<T>
100+
*/
97101
public function finally(callable $onFulfilledOrRejected): PromiseInterface
98102
{
99103
return $this->then(static function ($value) use ($onFulfilledOrRejected): PromiseInterface {
104+
/** @var T $value */
100105
return resolve($onFulfilledOrRejected())->then(function () use ($value) {
101106
return $value;
102107
});

tests/FunctionSetRejectionHandlerThatTriggersDefaultHandlerShouldTerminateProgramForUnhandled.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ echo 'NEVER';
2121

2222
?>
2323
--EXPECTF--
24-
Fatal error: Unexpected RuntimeException: foo in %s line %d
24+
%AFatal error: Unexpected RuntimeException: foo in %s%s

tests/FunctionSetRejectionHandlerThatTriggersErrorHandlerThatThrowsShouldTerminateProgramForUnhandled.phpt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,4 @@ echo 'NEVER';
2727
--EXPECTF--
2828
Fatal error: Uncaught OverflowException from unhandled promise rejection handler: This function should never throw in %s:%d
2929
Stack trace:
30-
#0 [internal function]: {closure%S}(%S)
31-
#1 %s(%d): trigger_error(%S)
32-
#2 %s/src/Internal/RejectedPromise.php(%d): {closure%S}(%S)
33-
#3 %s/src/functions.php(%d): React\Promise\Internal\RejectedPromise->__destruct()
34-
#4 %s(%d): React\Promise\reject(%S)
35-
#5 %A{main}
30+
%A

0 commit comments

Comments
 (0)