PhpStorm 2020.1 Help

Code Inspection: Undefined variable

Produces two types of warnings:

  • Undefined variable: the variable's definition is not found in the built-in library and project files.

  • Variable might have not been defined: there are one or more paths to reach the line with the variable usage without defining it.



Use the options below to customize the inspection:
  • Report that variable is probably undefined: clear the checkbox to disable the Variable might have not been defined warnings.

  • Enable inspection in global space: by default, the inspection is enabled for global space. Clear the checkbox to only report undefined variables from functions' local scope.

  • Report in files containing include statements: by default, all global-space variables in the files containing the include or require statements are considered defined. To enable inspecting and reporting such variables, select the checkbox and make sure the inspection is enabled for global space.

Last modified: 22 May 2020