Skip to content

Commit

Permalink
PHP 8.3 | InstalledVersionsTest: fix deprecation notice
Browse files Browse the repository at this point in the history
Calling `ReflectionProperty::setValue()` with only one argument (to set a static property) is deprecated.
Passing `null` as the first (`$object`) parameter will work cross-version.

Ref: https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#reflectionpropertysetvalue
  • Loading branch information
jrfnl committed Aug 28, 2023
1 parent 48548cb commit 2397db5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/Composer/Test/InstalledVersionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public static function setUpBeforeClass(): void
$prop = new \ReflectionProperty('Composer\Autoload\ClassLoader', 'registeredLoaders');
$prop->setAccessible(true);
self::$previousRegisteredLoaders = $prop->getValue();
$prop->setValue([]);
$prop->setValue(null, []);
}

public static function tearDownAfterClass(): void
{
$prop = new \ReflectionProperty('Composer\Autoload\ClassLoader', 'registeredLoaders');
$prop->setAccessible(true);
$prop->setValue(self::$previousRegisteredLoaders);
$prop->setValue(null, self::$previousRegisteredLoaders);
InstalledVersions::reload(null); // @phpstan-ignore-line
}

Expand Down

0 comments on commit 2397db5

Please sign in to comment.