<?php
trait StaticCall {
protected function callStatic($className, $methodName) {
$parameters = func_get_args();
$parameters = array_slice($parameters, 2);
return call_user_func_array($className . '::' . $methodName, $parameters);
}
}
class Base {
public function foo() { echo __METHOD__; }
}
class First extends Base {
use StaticCall;
public function foo() {
#$this->callStatic('parent', 'foo');
call_user_func_array('parent::foo', array());
}
}
class Second extends First {
use StaticCall;
}
$s = new Second();
$s->foo();