PhpStorm 2018.3 Help

Code Analysis

PhpStorm performs code analysis by applying inspections to your code. Code inspections work for PHP and other supported languages.

The inspections detect not only compiling errors, but also different code inefficiencies. Whenever you have some unreachable code, unused code, non-localized string, unresolved method, memory leaks or even spelling problems – you'll find it very quickly.

PhpStorm's code analysis is configurable. You can enable or disable each code inspection and change its severity, create profiles with custom sets of inspections, apply inspections differently in different scopes, suppress inspections in specific pieces of code, and more.

The analysis can be performed in several ways:

  • By default, PhpStorm analyses all open files and highlights all detected code issues right in the editor. On the right side of the editor you can see the analysis status of the whole file (the icon in the top-right corner).

    The severity levels are the following: an error (The error icon), a warning The warning icon, no issues found (The OK icon).

  • Alternatively, you can run code analysis in a bulk mode for the specified scope, which can be as large as the whole project.

  • If necessary, you can apply a single code inspection in a specific scope.

For the majority of the detected code issues, PhpStorm provides quick fix suggestions. You can quickly review errors in a file by navigating from one highlighted line to another by pressing F2Shift+F2.

PhpStorm analyses your projects on the various levels:

  • The on-the-fly analysis helps you to fix problems as you type. To apply a fix, use intention actions.

  • Code inspections are intended to point out issues related to the program design.

  • Highlighting level allows you to control the scope of problems highlighted in the current file.

Last modified: 18 March 2019

See Also