Psalm seems to have trouble dealing with the return value of PDOStatement::fetch(), even with a fetch mode specified.
$p = new \PDO("sqlite:::memory:");
$sth = $p->prepare("SELECT 1");
$sth->execute();
while (($row = $sth->fetch(\PDO::FETCH_ASSOC)) !== false) {
// ^-- MixedAssignment: Cannot assign $row to a mixed type
}
The only thing that seems to help is adding a /** @var array|false $row */ directly before $row, inside the condition of the while loop -- but this seems pretty awkward.
Psalm seems to have trouble dealing with the return value of
PDOStatement::fetch(), even with a fetch mode specified.The only thing that seems to help is adding a
/** @var array|false $row */directly before$row, inside the condition of the while loop -- but this seems pretty awkward.