php:当 ReflectionMethod 返回错误时,如何找出函数的定义位置

问题描述

$this->config = ED::config();
$this->jconfig = ED::jconfig();
$this->doc = JFactory::getDocument();
$this->app = JFactory::getApplication();
$this->input = ED::request();
$this->theme = ED::themes();

$method = new ReflectionMethod('ED','themes'); // Getting error message: 0 Method ED::themes() does not exist

这是在 Joomla 网络应用程序中。我试图找出 ED::themes() 的定义位置。我能够找到定义类 ED文件,但是,该文件中没有静态函数 themes。因此,我尝试使用 ReflectionMethod,但它返回一条错误消息,指出 ED::themes() 不存在。所以我被困在这里。如何找出此 ED::themes() 的定义位置?

解决方法

有问题的类具有 __callStatic magic method,它处理对不存在的静态方法(如 themes())的调用。除非类的开发人员记录了可用的方法,否则您必须自己检查 __callStatic 方法以找出最终被调用的内容。