1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Handle possibly null $arg_type

This commit is contained in:
cgocast 2023-09-28 15:34:05 +02:00
parent 55843b5ac8
commit d9400ba191

View File

@ -53,9 +53,9 @@ class PdoStatementReturnTypeProvider implements MethodReturnTypeProviderInterfac
foreach ($call_args as $call_arg) {
$arg_name = $call_arg->name;
if (!isset($arg_name) || $arg_name->name === "mode") {
$first_arg_type = $source->getNodeTypeProvider()->getType($call_arg->value);
if ($first_arg_type->isSingleIntLiteral()) {
$fetch_mode = $first_arg_type->getSingleIntLiteral()->value;
$arg_type = $source->getNodeTypeProvider()->getType($call_arg->value);
if (isset($arg_type) && $arg_type->isSingleIntLiteral()) {
$fetch_mode = $arg_type->getSingleIntLiteral()->value;
}
break;
}