PhpStorm 2020.2 Help

Code Inspection: Static method called as dynamic

Reports dynamic calls to static class methods.

If the target has the magic method __call , a separate inspection severity and highlighting level can be set.

In PHP 5, calling non-static methods statically generates an E_STRICT warning. In PHP 7, calling non-static methods statically is deprecated, and will generate an E_DEPRECATED warning. See Static methods (php.net) for details.

In the following example, the method foo() is called as dynamic while actually it is static.

class A { public static function foo() { } } $a = new A(); $a->foo();
Last modified: 08 May 2020