Problems With the php Function Get Called Class
When a static method is called, the class name of the object can be retrieved using the php function get_called_class. This is useful for ensuring that methods are properly called on the correct class. In most cases this is a better solution than just calling get_instance() as the latter can return an instance which could be the parent of the current class, not the correct one.
The problem is that the use of get_called_class in an instance method can cause problems if you have an overridden static method. For example if you have a dump method overridden with a function of the same name, get_called_class would return the incorrect class. To fix this you would need to pass the class as an argument to get_called_class, which can be a bit more complicated than just passing the name of the instance.
Another issue is the fact that if you call get_called_class with the wrong type of object, this can also cause problems as it will return a different value. In the case of obj being null it will throw an error, which is something you should be aware of when writing code that uses this function.
Thankfully this problem can be solved with the use of the newer PHP version, which contains a function that provides the same functionality as get_called_class without any of the issues mentioned above. For example, in PHP 5.2 the function is called class_get() which can be used to retrieve the correct class.