Closed jclaveau closed 5 years ago
Even if, since PHP 7 the syntax php $getMaxAge = (new DeferredCallChain)->setName('plop')::getMaxAge();
would throw a PHP Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)
, accessing $this during __callStatic produces produces an error.
Even exploiting debug_backtrace do not provide access to the instance on which the static method is called (until now at least).
The only solution I found which works (even for php 5) is to first call the function on the instance then on the class as a static method
This case can be useful for singletons for example with Class::getInstance()...