Вот такой вариант не подойдет?
<?php
class Catcher
{
public function __call($arg0, $arg1)
{
if ($arg0 === 'doX')
{
return $this->doX;
}
throw new ErrorException('Method not found!');
}
private $doX;
public function __construct()
{
$this->doX = new DoX();
}
}
class DoX
{
public function __call($arg0, $arg1)
{
return print_r([$arg0, $arg1], TRUE);
}
}
function dbg()
{
$args = func_get_args();
foreach($args as $arg)
{
echo strtr('<pre>:text</pre>', array(
':text' => print_r($arg, TRUE),
));
}
}
echo (new Catcher)->doX()->doY();