Skip to content

Commit

Permalink
Update Calling ReflectionProperty::setValue() with object
Browse files Browse the repository at this point in the history
  • Loading branch information
thelovekesh committed Oct 6, 2023
1 parent 30736fe commit 0a0fae6
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 0a0fae6

Please sign in to comment.