PhpStorm
 
Get PhpStorm
You are viewing the documentation for an earlier version of PhpStorm.

Code Inspection: Method can be made 'static'

Last modified: 16 May 2022

Reports the methods that don't use any instance references and thus may be converted to static methods.

Static methods normally belong to utility classes and are accessed in the context of a class rather than an object. In the following example, the foo method does not use any instance references, and can therefore be declared as static.