Skip to content

MIR0233

PossiblyFalsePropertyAssignmentValue

A value assigned to a property may be false, which the property’s type doesn’t accept.

<?php
class Counter {
public int $n = 0;
public function set(int|false $value): void {
$this->n = $value;
}
}

Handle the false result (often a failure return) before assigning.