diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementReturnTypeProvider.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementReturnTypeProvider.php index 37a3f199954..0ed2c493f62 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementReturnTypeProvider.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/PdoStatementReturnTypeProvider.php @@ -53,9 +53,9 @@ private static function handleFetch(MethodReturnTypeProviderEvent $event): ?Unio 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; }