Code Inspection: Expression is always 'null'
Configure inspections: Settings | Editor | Inspections
Show intention actions: AltEnter
Reports the variables in return
statements that are always null
.
In the following example, the $var
variable returned from within the conditional statement is always null
. After the quick-fix is applied, the variable is replaced with the explicit null
value.
Before the quick-fix
function getValue($var) { if ($var === null) { return $var; } return $var;}
After the quick-fix
function getValue($var) { if ($var === null) { return null; } return $var;}
Place the caret at the highlighted line and press AltEnter or click
.
Click the arrow next to the inspection you want to suppress and select the necessary suppress action.