Skip to content

Commit edd1c2d

Browse files
authored
Merge pull request clue#124 from clue-labs/php8.5
Improve PHP 8.5+ support by avoiding deprecated `setAccessible()` calls
2 parents d2cfadd + 88abc98 commit edd1c2d

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 4 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.5
1415
- 8.4
1516
- 8.3
1617
- 8.2
@@ -26,7 +27,7 @@ jobs:
2627
- 5.4
2728
- 5.3
2829
steps:
29-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v6
3031
- uses: shivammathur/setup-php@v2
3132
with:
3233
php-version: ${{ matrix.php }}
@@ -37,10 +38,10 @@ jobs:
3738

3839
PHPUnit-hhvm:
3940
name: PHPUnit (HHVM)
40-
runs-on: ubuntu-22.04
41+
runs-on: ubuntu-24.04
4142
continue-on-error: true
4243
steps:
43-
- uses: actions/checkout@v4
44+
- uses: actions/checkout@v6
4445
- run: cp "$(which composer)" composer.phar && ./composer.phar self-update --2.2 # downgrade Composer for HHVM
4546
- name: Run hhvm composer.phar install
4647
uses: docker://hhvm/hhvm:3.30-lts-latest

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
],
1313
"require": {
1414
"php": ">=5.3",
15-
"react/promise": "^3.2 || ^2.1 || ^1.2",
16-
"react/socket": "^1.16"
15+
"react/promise": "^3.3 || ^2.1 || ^1.2",
16+
"react/socket": "^1.17"
1717
},
1818
"require-dev": {
1919
"clue/connection-manager-extra": "^1.3",
2020
"phpunit/phpunit": "^9.6 || ^8.5 || ^5.7 || ^4.8.36",
2121
"react/async": "^4.3 || ^3 || ^2",
22-
"react/event-loop": "^1.2",
22+
"react/event-loop": "^1.6",
2323
"react/http": "^1.11"
2424
},
2525
"autoload": {

src/Client.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ function (Exception $e) use ($uri, $deferred) {
207207
// avoid garbage references by replacing all closures in call stack.
208208
// what a lovely piece of code!
209209
$r = new \ReflectionProperty('Exception', 'trace');
210-
$r->setAccessible(true);
210+
if (PHP_VERSION_ID < 80100) {
211+
$r->setAccessible(true);
212+
}
211213
$trace = $r->getValue($e);
212214

213215
// Exception trace arguments are not available on some PHP 7.4 installs

tests/ClientTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public function testConstructWithoutConnectorAssignsConnectorAutomatically()
2828
$proxy = new Client('127.0.0.1:1080');
2929

3030
$ref = new \ReflectionProperty($proxy, 'connector');
31-
$ref->setAccessible(true);
31+
if (PHP_VERSION_ID < 80100) {
32+
$ref->setAccessible(true);
33+
}
3234
$connector = $ref->getValue($proxy);
3335

3436
$this->assertInstanceOf('React\Socket\ConnectorInterface', $connector);

tests/ServerTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ public function testConstructWithoutLoopAssignsLoopAutomatically()
3333
$server = new Server();
3434

3535
$ref = new \ReflectionProperty($server, 'loop');
36-
$ref->setAccessible(true);
36+
if (PHP_VERSION_ID < 80100) {
37+
$ref->setAccessible(true);
38+
}
3739
$loop = $ref->getValue($server);
3840

3941
$this->assertInstanceOf('React\EventLoop\LoopInterface', $loop);

0 commit comments

Comments
 (0)