2016-05-15 01:33:21 +03:00
|
|
|
<?php
|
2019-12-05 00:52:27 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-02-20 22:58:52 +03:00
|
|
|
namespace common\tests\_support;
|
2016-05-15 01:33:21 +03:00
|
|
|
|
|
|
|
use ReflectionClass;
|
|
|
|
|
2019-12-05 00:52:27 +03:00
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
*/
|
2016-05-15 01:33:21 +03:00
|
|
|
trait ProtectedCaller {
|
|
|
|
|
2019-12-05 00:52:27 +03:00
|
|
|
protected function callProtected(object $object, string $methodName, ...$args) {
|
2016-05-15 01:33:21 +03:00
|
|
|
$class = new ReflectionClass($object);
|
2019-12-05 00:52:27 +03:00
|
|
|
$method = $class->getMethod($methodName);
|
2016-05-15 01:33:21 +03:00
|
|
|
$method->setAccessible(true);
|
|
|
|
|
|
|
|
return $method->invokeArgs($object, $args);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|