Skip to content

Commit 0f7aed2

Browse files
Add test
1 parent 99b0fb1 commit 0f7aed2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

tests/PHPStan/Rules/Functions/ParameterCastableToNumberRuleTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,14 @@ public function testBug13775TerWithoutUnion(): void
249249
'Parameter #1 $array of function array_product expects an array of values castable to number, array<int, mixed> given.',
250250
6,
251251
],
252+
[
253+
'Parameter #1 $array of function array_sum expects an array of values castable to number, array<string> given.',
254+
14,
255+
],
256+
[
257+
'Parameter #1 $array of function array_product expects an array of values castable to number, array<string> given.',
258+
15,
259+
],
252260
]));
253261
}
254262

tests/PHPStan/Rules/Functions/data/bug-13775-ter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@
88
$b = rand(0, 1) ? 42 : '';
99
echo array_sum([$b]) . "\n\n";
1010
echo array_product([$b]) . "\n\n";
11+
12+
/** @var iterable<int>|array<string> $c */
13+
$c = doFoo();
14+
echo array_sum($c) . "\n\n";
15+
echo array_product($c) . "\n\n";

0 commit comments

Comments
 (0)