Open staabm opened 2 years ago
PDO::FETCH_CLASS support would also be nice IMO
@xPaw since you are using some fetch types we do not yet support type-inference for: do you plan working on the missing fetch-modes?
I will support you in case there are questions left.
I don't currently have plans to look into that, sorry.
One thing worth pointing out is that some of the FETCH constants are actually flags, and not unique modes (thus they can be combined with some modes).
One thing worth pointing out is that some of the FETCH constants are actually flags, and not unique modes (thus they can be combined with some modes).
good point.
feel free to provide failing unit tests or open issues with concrete examples of things you used/found in the wild.
I am not interessted in adding every theoretical possible combination, but just those things people actually use
PdoStatement->fetch*()
Pdo->query()
PdoStatement->fetch*()
Pdo->query()
PdoStatement->fetchAll()
PdoStatement->fetchObject()
Pdo->query()
PdoStatement->setFetchMode*()
See
relevant in
$pdo->query($query, $fetchMode);
$stmt->setFetchMode($fetchMode)
$stmt->fetch($fetchMode)
relevant code parts: https://github.com/staabm/phpstan-dba/blob/4d442193a977424c78dc66de0ca65e50d84b40ff/src/PdoReflection/PdoStatementReflection.php#L49-L55 https://github.com/staabm/phpstan-dba/blob/4d442193a977424c78dc66de0ca65e50d84b40ff/src/PdoReflection/PdoStatementReflection.php#L96-L121
and adding corresponding tests in
https://github.com/staabm/phpstan-dba/blob/main/tests/default/data/pdo.php