There is actually a workaround for this, using the creation of the magic method, although I will most likely never do something like this in production code:
__call runs internally when an inaccessible method is called on an object scope.
__callStatic runs internally when an invalid method is called in a static scope.
<?php
class Test
{
public function __call($name, $args)
{
echo 'called '.$name.' in object context\n';
}
public static function __callStatic($name, $args)
{
echo 'called '.$name.' in static context\n';
}
}
$o = new Test;
$o->doThis('object');
Test::doThis('static');
?>
source
share