Skip to content

Commit

Permalink
PHP 8.3 | ReportWidthTest: fix deprecation notices for ReflectionProp…
Browse files Browse the repository at this point in the history
…erty::setValue()

The `ReflectionProperty::setValue()` method supports three method signatures, two of which are deprecated as of PHP 8.3.

This adjusts the call to `ReflectionProperty::setValue()` in the `Core/Config/ReportWidthTest` to pass `null` as the "object" for setting the value of a static property to make the method call cross-version compatible.

Ref: https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#reflectionpropertysetvalue
  • Loading branch information
jrfnl committed Jul 20, 2023
1 parent 354b4c5 commit 300d6d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/Core/Config/ReportWidthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ public static function setStaticProperty($name, $value)
{
$property = new ReflectionProperty('PHP_CodeSniffer\Config', $name);
$property->setAccessible(true);
$property->setValue($value);
$property->setValue(null, $value);
$property->setAccessible(false);

}//end setStaticProperty()
Expand Down

0 comments on commit 300d6d6

Please sign in to comment.