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