Code Inspection: Typed property might be uninitialized
Reports the attempts to read from an uninitialized typed property. Such attempts will result in TypeError
.
by a default value
in the constructor
by the
__get()
magic getterin-place, at the moment of usage
In the following example, the $prop
property is accessed before being initialized, which will result in a PHP Fatal error
:
class ExampleClass {
public int $prop;
}
$a = new ExampleClass();
echo $a->prop;
Suppress an inspection in the editor
Position the caret at the highlighted line and press Alt+Enter or click .
Click the arrow next to the inspection you want to suppress and select the necessary suppress action.
Last modified: 11 February 2022