PhpStorm 2020.3 Help

Code Inspection: Dynamic method called as static

Reports static calls to dynamic class methods.

For classes having the magic method __callStatic , a separate inspection severity and highlighting level can be set.

In PHP 5.6 and later, calling static methods dynamically is deprecated and generates an E_DEPRECATED warning. As of PHP 7.0, calling a non-static method statically results in $this being undefined inside the method. See OOP Basics ( for details.

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

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