mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Loop over PDOStatement::fetch() arguments
This commit is contained in:
parent
83485f3fcf
commit
2217f5e118
@ -49,12 +49,16 @@ class PdoStatementReturnTypeProvider implements MethodReturnTypeProviderInterfac
|
||||
$source = $event->getSource();
|
||||
$call_args = $event->getCallArgs();
|
||||
$fetch_mode = 0;
|
||||
|
||||
if (isset($call_args[0])
|
||||
&& ($first_arg_type = $source->getNodeTypeProvider()->getType($call_args[0]->value))
|
||||
&& $first_arg_type->isSingleIntLiteral()
|
||||
) {
|
||||
$fetch_mode = $first_arg_type->getSingleIntLiteral()->value;
|
||||
|
||||
foreach($call_args as $call_arg) {
|
||||
$arg_name = $call_arg->name->name;
|
||||
if (!isset($arg_name) || $arg_name === "mode") {
|
||||
$first_arg_type = $source->getNodeTypeProvider()->getType($call_arg->value);
|
||||
if ($first_arg_type->isSingleIntLiteral()) {
|
||||
$fetch_mode = $first_arg_type->getSingleIntLiteral()->value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($fetch_mode) {
|
||||
|
Loading…
Reference in New Issue
Block a user