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. For more information, refer to OOP Basics (php.net).
In the following example, the method
foo() is called as static while actually it is dynamic.
Suppress an inspection in the editor
Place the caret at the highlighted line and press Alt+Enter or click .
Click the arrow next to the inspection you want to suppress and select the necessary suppress action.