In the absence of any description of symptoms......
When a class method with a certain name is called, PHP looks to see if there is a method with that name already defined. Only if it doesn't find it will it use the __call() method in an attempt to work out what you were wanting.
Since BaseClassTimer is derived from BaseClass, it has inherited all of BaseClass's methods.
The other thing is that __call isn't a static method (because static methods can't call instance methods), so it won't be invoked when a static call fails to find a method already defined.
So I wrote this to time static method calls. Create an timer object, passing it the name of the class you're interested in (I did that to make it a bit more useful than hardwiring one particular class into it), then call the class methods you're testing as though they were instance methods of the object.
class BaseClass
{
static function wibble($a, $b)
{
echo "Wibbling $a $b ".__CLASS__,"\n";
}
}
class ClassTimer
{
private $baseClass;
public function __construct($baseClass)
{
$this->baseClass = $baseClass;
}
function __call($name, $arguments)
{
echo "Start timing....now!\n";
return call_user_func_array(array($this->baseClass, $name), $arguments);
}
}
$t = new ClassTimer('BaseClass');
$t->wibble(4,5);