Вызвать private метод класса в PHP

function callPrivateMethod($object, $method, $args)
{
    $classReflection = new \ReflectionClass(get_class($object));
    $methodReflection = $classReflection->getMethod($method);
    $methodReflection->setAccessible(true);
    $result = $methodReflection->invokeArgs($object, $args);
    $methodReflection->setAccessible(false);
    return $result;
}
 
$myObject = new MyClass();
callPrivateMethod($myObject, 'hello', ['world']);