Skip to content

Commit b38cec4

Browse files
authored
Merge pull request #7911 from kenjis/fix-ReflectionHelper-setValue
[PHP 8.3] refactor: ReflectionProperty::setValue() signature deprecation
2 parents eb1d5e0 + ddd2317 commit b38cec4

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

system/Test/ReflectionHelper.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ private static function getAccessibleRefProperty($obj, $property)
7474
public static function setPrivateProperty($obj, $property, $value)
7575
{
7676
$refProperty = self::getAccessibleRefProperty($obj, $property);
77-
$refProperty->setValue($obj, $value);
77+
78+
if (is_object($obj)) {
79+
$refProperty->setValue($obj, $value);
80+
} else {
81+
$refProperty->setValue(null, $value);
82+
}
7883
}
7984

8085
/**

tests/system/CLI/CLITest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,13 @@ public function testWindow(): void
438438
{
439439
$height = new ReflectionProperty(CLI::class, 'height');
440440
$height->setAccessible(true);
441-
$height->setValue(null);
441+
$height->setValue(null, null);
442442

443443
$this->assertIsInt(CLI::getHeight());
444444

445445
$width = new ReflectionProperty(CLI::class, 'width');
446446
$width->setAccessible(true);
447-
$width->setValue(null);
447+
$width->setValue(null, null);
448448

449449
$this->assertIsInt(CLI::getWidth());
450450
}

0 commit comments

Comments
 (0)