I'm not quite sure why __callStatic () is important here?
I do not quite understand the difference between:
class Foo { static function bar() { $obj = new Foo(); $obj->quux(); } function quux() { return "whatever"; } }
and your example? In both scenarios, you invoke a static method that calls another method on an object of the same class.
Yes it is possible. Actually, this suggests that you might want to reorganize your code. In the example, you create an object with its default state, execute a method on it, and then drop the object. This indicates that the method that does not actually need the state of the objects. This means that it either does not belong to this class, or simply can be rewritten as a static method.
And do you know about __call? It does the same as __callStatic, but for objects, not classes. For instance. $ Foo-> myMissingMethod (); will go to __call if such a method exists for a class for which $ foo is an instance.
source share