Test case:
public function testWithBind(PDO $pdo)
{
$stmt = $pdo->prepare('SELECT email, adaid FROM ada WHERE adaid = :adaid');
$stmt->bindValue('adaid', 1);
$stmt->execute();
$all = $stmt->fetch(PDO::FETCH_ASSOC);
assertType('array{email: string, adaid: int<-32768, 32767>}|false', $all);
}
-'array{email: string, adaid: int<-32768, 32767>}|false'
+'mixed'
I've roughly boiled it down to PdoMysqlQueryReflector not accepting parameters into simulateQuery which means the query just throws on unbound parameters. Even though this PDOException gets cached, it never gets reported anywhere, so I didn't even know if this was an issue with the PDO calls not being discovered or not.
PdoStatementExecuteMethodRule does try to find and resolve the bind parameters, so I wonder if this should actually attach the type to the statement somehow, so that fetch calls didn't need to simulate the query again.
This also means PdoPrepareDynamicReturnTypeExtension tries to simulate the query with placeholders and gets PDOException due to unbound parameters.
Mildly related to #275.
Test case:
I've roughly boiled it down to
PdoMysqlQueryReflectornot accepting parameters intosimulateQuerywhich means the query just throws on unbound parameters. Even though this PDOException gets cached, it never gets reported anywhere, so I didn't even know if this was an issue with the PDO calls not being discovered or not.PdoStatementExecuteMethodRuledoes try to find and resolve the bind parameters, so I wonder if this should actually attach the type to the statement somehow, so thatfetchcalls didn't need to simulate the query again.This also means
PdoPrepareDynamicReturnTypeExtensiontries to simulate the query with placeholders and gets PDOException due to unbound parameters.Mildly related to #275.