diff --git a/stubs/CoreGenericFunctions.phpstub b/stubs/CoreGenericFunctions.phpstub index b4bcaaff9b3..f37af3c13c1 100644 --- a/stubs/CoreGenericFunctions.phpstub +++ b/stubs/CoreGenericFunctions.phpstub @@ -760,7 +760,8 @@ function preg_replace_callback($search, $replace, $subject, int $limit = -1, &$c * ) * ) * ) $matches - * @return int + * @return int|false + * @psalm-ignore-falsable-return */ function preg_match_all($pattern, $replace, &$matches = [], int $flags = 1, int $offset = 0) {} diff --git a/tests/FunctionCallTest.php b/tests/FunctionCallTest.php index ca4583fcf50..b22171c2c9e 100644 --- a/tests/FunctionCallTest.php +++ b/tests/FunctionCallTest.php @@ -1341,6 +1341,15 @@ function foo(string $input): array { return $matches[0]; }' ], + 'pregMatchAllReturnsFalse' => [ + ' [ '