PhpStorm 2021.1 Help

Code Inspection: Variable is declared and being used in different 'case' clauses

Reports variables that are declared in one case clause of a switch statement, and are used in a different case clause of the same statement. For block-scope variables, this results in a ReferenceError being thrown. For var -variables, it signifies a potential error. This inspection can be disabled for var -variables if you use this pattern intentionally.

Suppress an inspection in the editor

  1. Position the caret at the highlighted line and press Alt+Enter or click the Intention action icon.

  2. Click the arrow next to the inspection you want to suppress and select the necessary suppress action.

Last modified: 08 March 2021