A regular ternary triggers refactor suggestion: Simplify with ?? PHP(PHP7103).
$var1 = false;
$var2 = $var1 ? $var1 : [];
|
$var2 = $var1 ?? [];
The null coalescing operator can't be used with variables that aren't null.
The correct refactor would be to use ?:
and that's considered a risky conversion judging by PHP CS Fixer rules.
Simplifying with ??
would be a nice refactor, but only where the variable is actually nullable.