PhpStorm 2021.1 Help

Code Inspection: Typed Property might be uninitialized

Reports the attempts to read from an uninitialized typed property. Such attempts will result in TypeError.

Typed properties should be initialized in any of the following ways:

  • by a default value

  • in the constructor

  • by the __get() magic getter

  • in-place, at the moment of usage



See Uninitialized and Unset Properties (php.net) for details.

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: 14 July 2021