MIR0214
PossiblyNullOperand
An arithmetic or string operation is performed on a value that could be null. Passing null
to most operators produces unexpected results or a warning at runtime.
Example
Section titled “Example”<?phpfunction divide(?int $a, int $b): float { return $a / $b; // $a could be null}How to fix
Section titled “How to fix”Guard against null before the operation:
<?phpfunction divide(?int $a, int $b): float { if ($a === null) { return 0.0; } return $a / $b;}