有没有办法记录某个类对另一个类中定义的每个方法都有魔术方法?
我正在使用PHPStorm,所以我会对任何可以自动完成正常工作的解决方案感到满意.
class A { // a bunch of functions go here... } /** * Class B * What should go here to make it work??? */ class B { private $aInstance; public function __construct() { $this->aInstance = new A(); } public function __call($name,$arguments) { // TODO: Implement __call() method. if(method_exists($this->aInstance,$name)) { return $this->aInstance->{$name}(...$arguments); } throw new BadMethodCallException(); } // a bunch more functions go here... }