mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Merge pull request #10237 from cgocast/5.x
Loop over PDOStatement::fetch() arguments
This commit is contained in:
commit
e110305644
@ -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;
|
||||
if (!isset($arg_name) || $arg_name->name === "mode") {
|
||||
$arg_type = $source->getNodeTypeProvider()->getType($call_arg->value);
|
||||
if (isset($arg_type) && $arg_type->isSingleIntLiteral()) {
|
||||
$fetch_mode = $arg_type->getSingleIntLiteral()->value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($fetch_mode) {
|
||||
|
Loading…
Reference in New Issue
Block a user