Skip to content

Commit

Permalink
Fix PHP 8.3 deprecation warning in ReflectionClass::setValue
Browse files Browse the repository at this point in the history
  • Loading branch information
thelovekesh committed Sep 12, 2023
1 parent 1e8de9a commit 7ffc0eb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions tests/php/src/Helpers/PrivateAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ private function call_private_static_method( $class, $method_name, $args = [] )
private function set_private_property( $object, $property_name, $value ) {
$property = ( new ReflectionClass( $object ) )->getProperty( $property_name );
$property->setAccessible( true );

// Note: In PHP 8, `ReflectionProperty::getValue()` now requires that an object be supplied if it's a
// non-static property.
$property->isStatic() ? $property->setValue( $value ) : $property->setValue( $object, $value );
$property->setValue( $object, $value );
}

/**
Expand Down

0 comments on commit 7ffc0eb

Please sign in to comment.