PhpStorm 2023.3 Help

Code Inspections in General

This topic lists all PhpStorm code inspections available in General.

You can toggle specific inspections or change their severity level on the Editor | Inspections page of the IDE settingsĀ  Ctrl+Alt+S.

Inspection

Description

Default Severity

Annotator

Reports issues essential to this file (e.g., syntax errors) in the result of a batch code inspection run. These kinds of issues are usually always highlighted when you open the file in the editor and can't be configured (unlike inspections). The options below are controlling the analysis level of this inspection:

  • Option "Highlight syntax errors" allows to report parser-related issues.

  • Option "Run language annotators" allows to report issues found by annotators configured for this language. See Custom Language Support: Annotators for details.

  • Option "Run language-specific highlight visitors" allows to report issues inherent to this file language (e.g., type mismatches or unreported exceptions etc.). See Custom Language Support: Highlighting for details.

Error Error

Empty directory

Reports empty directories.

Available only from Code | Inspect Code or Code | Analyze Code | Run Inspection by Name and isn't reported in the editor.

Use the Only report empty directories located under a source folder option to have only directories under source roots reported.

Disabled

Inconsistent line separators

Reports files with line separators different from the ones that are specified in the project's settings.

For example, the inspection will be triggered if you set the line separator to \n in Settings | Editor | Code Style | Line separator, while the file you are editing uses \r\n as a line separator.

The inspection also warns you about mixed line separators within a file.

Disabled

Incorrect formatting

Reports formatting issues that appear if your code doesn't follow your project's code style settings.

This inspection is not compatible with languages that require third-party formatters for code formatting, for example, Go or C with CLangFormat enabled.

Disabled

Injected references

Reports unresolved references injected by Language Injections.

Example:

@Language("file-reference") String fileName = "/home/user/nonexistent.file"; // highlighted if file doesn't exist

Error Error

Line is longer than allowed by code style

Reports lines that are longer than the Hard wrap at parameter specified in Settings | Editor | Code Style | General.

Disabled

Problematic whitespace

Reports the following problems:

  • Tabs used for indentation when the code style is configured to use only spaces.

  • Spaces used for indentation when the code style is configured to use only tabs.

  • Spaces used for indentation and tabs used for alignment when the code style is configured to use smart tabs.

Disabled

Qodana service message

Reports the Qodana service messages such as suspending a particular inspection due to a large number of reported problems.

Disabled

Reassigned to plain text

Reports files that were explicitly re-assigned to Plain Text File Type. This association is unnecessary because the platform auto-detects text files by content automatically.

You can dismiss this warning by removing the file type association in Settings | Editor | File Types | Text.

Warning Warning

Redundant suppression

Reports usages of the following elements that can be safely removed because the inspection they affect is no longer applicable in this context:

  • @SuppressWarning annotation, or

  • // noinspection line comment, or

  • /** noinspection */ JavaDoc comment

Example:

public class C { // symbol is already private, // but annotation is still around @SuppressWarnings({"WeakerAccess"}) true; void f() { CONST = false; } }

Warning Warning

TODO comment

Reports TODO comments in your code.

You can configure the format for TODO comments in Settings | Editor | TODO.

Enable the Only warn on TODO comments without any details option to only warn on empty TODO comments, that don't provide any description on the task that should be done. Disable to report all TODO comments.

Disabled

Last modified: 25 March 2024