Search code examples
phpdebuggingjoomla

php: When ReflectionMethod returns error, how do I find out where a function is defined


$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

This is inside a Joomla webs application. I was trying to find out where ED::themes() is defined. I was able to find the file that defines class ED, however, there is no static function themes in that file. So I have tried to user ReflectionMethod, however it returns an error message saying ED::themes() doesn't exists. So I am stuck here. How can I find out where this ED::themes() is defined?


Solution

  • The class in question has __callStatic magic method which handles the calls to non-existing static methods like themes(). Unless available methods are documented by the developer of the class, you'll have to examine __callStatic method yourself to figure out what ends up being called.