Skip to content

Commit ceb85e0

Browse files
[2.3] PHP 8.5 support (#183)
* PHP 8.5 support * Update CoroutineTest.php * Fix deprecations
1 parent 7c69f28 commit ceb85e0

File tree

13 files changed

+46
-31
lines changed

13 files changed

+46
-31
lines changed

.github/workflows/checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ permissions:
1111
jobs:
1212
composer-normalize:
1313
name: Composer Normalize
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-24.04
1515

1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v5
1919

2020
- name: Composer normalize
2121
uses: docker://ergebnis/composer-normalize-action

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111
jobs:
1212
build-lowest-version:
1313
name: Build lowest version
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-24.04
1515

1616
steps:
1717
- name: Set up PHP
@@ -23,7 +23,7 @@ jobs:
2323
extensions: mbstring
2424

2525
- name: Checkout code
26-
uses: actions/checkout@v4
26+
uses: actions/checkout@v5
2727

2828
- name: Install dependencies
2929
run: composer update --no-interaction --prefer-stable --prefer-lowest --no-progress
@@ -33,11 +33,11 @@ jobs:
3333

3434
build:
3535
name: Build
36-
runs-on: ubuntu-22.04
36+
runs-on: ubuntu-24.04
3737
strategy:
3838
max-parallel: 10
3939
matrix:
40-
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
40+
php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
4141

4242
steps:
4343
- name: Set up PHP
@@ -49,7 +49,7 @@ jobs:
4949
extensions: mbstring
5050

5151
- name: Checkout code
52-
uses: actions/checkout@v4
52+
uses: actions/checkout@v5
5353

5454
- name: Install dependencies
5555
run: composer update --no-interaction --no-progress

.github/workflows/static.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ permissions:
1111
jobs:
1212
phpstan:
1313
name: PHPStan
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-24.04
1515

1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v5
1919

2020
- name: Setup PHP
2121
uses: shivammathur/setup-php@v2
2222
with:
23-
php-version: '7.4'
23+
php-version: '8.2'
2424
coverage: none
2525
extensions: mbstring
2626

@@ -35,11 +35,11 @@ jobs:
3535

3636
php-cs-fixer:
3737
name: PHP-CS-Fixer
38-
runs-on: ubuntu-22.04
38+
runs-on: ubuntu-24.04
3939

4040
steps:
4141
- name: Checkout code
42-
uses: actions/checkout@v4
42+
uses: actions/checkout@v5
4343

4444
- name: Setup PHP
4545
uses: shivammathur/setup-php@v2
@@ -59,16 +59,16 @@ jobs:
5959

6060
psalm:
6161
name: Psalm
62-
runs-on: ubuntu-22.04
62+
runs-on: ubuntu-24.04
6363

6464
steps:
6565
- name: Checkout code
66-
uses: actions/checkout@v4
66+
uses: actions/checkout@v5
6767

6868
- name: Setup PHP
6969
uses: shivammathur/setup-php@v2
7070
with:
71-
php-version: '7.4'
71+
php-version: '8.2'
7272
coverage: none
7373
extensions: mbstring
7474

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ composer require guzzlehttp/promises
4141
| Version | Status | PHP Version |
4242
|---------|---------------------|--------------|
4343
| 1.x | Security fixes only | >=5.5,<8.3 |
44-
| 2.x | Latest | >=7.2.5,<8.5 |
44+
| 2.x | Latest | >=7.2.5,<8.6 |
4545

4646

4747
## Quick Start

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"require-dev": {
3232
"bamarni/composer-bin-plugin": "^1.8.2",
33-
"phpunit/phpunit": "^8.5.39 || ^9.6.20"
33+
"phpunit/phpunit": "^8.5.44 || ^9.6.25"
3434
},
3535
"autoload": {
3636
"psr-4": {

psalm-baseline.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0"/>
2+
<files psalm-version="6.13.1@1e3b7f0a8ab32b23197b91107adc0a7ed8a05b51"/>

psalm.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@
1515
<directory name="vendor" />
1616
</ignoreFiles>
1717
</projectFiles>
18+
19+
<issueHandlers>
20+
<MissingOverrideAttribute errorLevel="suppress" />
21+
</issueHandlers>
1822
</psalm>

tests/CoroutineTest.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,17 @@ public function testShouldProxyPromiseMethodsToResultPromise($method, $args = []
3131
$mockPromise->expects($this->once())->method($method)->with(...$args);
3232

3333
$resultPromiseProp = (new ReflectionClass(Coroutine::class))->getProperty('result');
34-
$resultPromiseProp->setAccessible(true);
34+
35+
if (PHP_VERSION_ID < 80100) {
36+
$resultPromiseProp->setAccessible(true);
37+
}
38+
3539
$resultPromiseProp->setValue($coroutine, $mockPromise);
3640

3741
$coroutine->{$method}(...$args);
3842
}
3943

40-
public function promiseInterfaceMethodProvider()
44+
public static function promiseInterfaceMethodProvider()
4145
{
4246
return [
4347
['then', [null, null]],
@@ -59,14 +63,18 @@ public function testShouldCancelResultPromiseAndOutsideCurrentPromise(): void
5963
];
6064
foreach ($mockPromises as $propName => $mockPromise) {
6165
/**
62-
* @var $mockPromise \PHPUnit_Framework_MockObject_MockObject
66+
* @var \PHPUnit_Framework_MockObject_MockObject $mockPromise
6367
*/
6468
$mockPromise->expects($this->once())
6569
->method('cancel')
6670
->with();
6771

6872
$promiseProp = (new ReflectionClass(Coroutine::class))->getProperty($propName);
69-
$promiseProp->setAccessible(true);
73+
74+
if (PHP_VERSION_ID < 80100) {
75+
$promiseProp->setAccessible(true);
76+
}
77+
7078
$promiseProp->setValue($coroutine, $mockPromise);
7179
}
7280

tests/PropertyHelper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ class PropertyHelper
2222
public static function get($object, $property)
2323
{
2424
$property = (new \ReflectionObject($object))->getProperty($property);
25-
$property->setAccessible(true);
25+
26+
if (PHP_VERSION_ID < 80100) {
27+
$property->setAccessible(true);
28+
}
2629

2730
return $property->getValue($object);
2831
}

tests/UtilsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ function ($reason) use (&$result): void { $result = $reason; }
318318
$this->assertSame('a', $result->getMessage());
319319
}
320320

321-
public function rejectsParentExceptionProvider()
321+
public static function rejectsParentExceptionProvider()
322322
{
323323
return [
324324
[P\Coroutine::of(function () {

0 commit comments

Comments
 (0)