Skip to content

Commit

Permalink
Add a failing test case for not passing in 3rd param
Browse files Browse the repository at this point in the history
  • Loading branch information
BackEndTea committed Jun 12, 2021
1 parent 3b132ff commit af19c52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Expand Up @@ -560,6 +560,10 @@ public function testArrayFunctionCallbackIsValidated(): void
'Parameter #2 $callback of function array_reduce expects callable(string, int|string): string, Closure(string, string): string given.',
5,
],
[
'Parameter #2 $callback of function array_reduce expects callable(string|null, int): string, Closure(string, int): string given.',
11
]
]);

$this->analyse([__DIR__ . '/data/array_map.php'], [
Expand Down
5 changes: 5 additions & 0 deletions tests/PHPStan/Rules/Functions/data/array_reduce.php
Expand Up @@ -5,3 +5,8 @@
fn(string $foo, string $current): string => $foo . $current,
''
);

array_reduce(
[1,2,3],
fn(string $foo, int $current): string => $foo . $current
);

0 comments on commit af19c52

Please sign in to comment.