Internal Static Call

no-email (Damien Seguy), Damien Seguy
Wed, 28 Sep 2022 00:00:00 +0000

Trap of the day : one of the calls in bar() will generate a 'Non-static method a::foo() cannot be called statically' error.
Which one? It is the d::foo(). All other calls are made within the C class : internal calls may use static or normal syntax, while external calls must use the correct call syntax. This allows calls like 'parent::__construct()'.
When the call to bar() is made with '(new d)', the 'd::foo()' works again.