Skip to content

Commit 4e998a5

Browse files
committed
[1.x] Fix reflection setAccessible deprecatoin warnings
In PHP8.1 ReflectionProperty::setAccessible was made a no-op through https://wiki.php.net/rfc/make-reflection-setaccessible-no-op in PHP8.5 it is now throwing a deprecation warning by: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_reflectionsetaccessible
1 parent 583914e commit 4e998a5

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

tests/DuplexResourceStreamTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ public function testConstructWithoutLoopAssignsLoopAutomatically()
2727
$stream = new DuplexResourceStream($resource);
2828

2929
$ref = new \ReflectionProperty($stream, 'loop');
30-
$ref->setAccessible(true);
30+
if (PHP_VERSION_ID < 80100) {
31+
$ref->setAccessible(true);
32+
}
3133
$loop = $ref->getValue($stream);
3234

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

tests/ReadableResourceStreamTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public function testConstructWithoutLoopAssignsLoopAutomatically()
2626
$stream = new ReadableResourceStream($resource);
2727

2828
$ref = new \ReflectionProperty($stream, 'loop');
29-
$ref->setAccessible(true);
29+
if (PHP_VERSION_ID < 80100) {
30+
$ref->setAccessible(true);
31+
}
3032
$loop = $ref->getValue($stream);
3133

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

tests/WritableResourceStreamTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public function testConstructWithoutLoopAssignsLoopAutomatically()
2626
$stream = new WritableResourceStream($resource);
2727

2828
$ref = new \ReflectionProperty($stream, 'loop');
29-
$ref->setAccessible(true);
29+
if (PHP_VERSION_ID < 80100) {
30+
$ref->setAccessible(true);
31+
}
3032
$loop = $ref->getValue($stream);
3133

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

0 commit comments

Comments
 (0)