Skip to content

Commit 5f1da36

Browse files
committed
Add another regression test
1 parent 6bb4e31 commit 5f1da36

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

+5
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,11 @@ public function testBug3608(): void
545545
$this->analyse([__DIR__ . '/data/bug-3608.php'], []);
546546
}
547547

548+
public function testBug3631(): void
549+
{
550+
$this->analyse([__DIR__ . '/data/bug-3631.php'], []);
551+
}
552+
548553
public function testBug3920(): void
549554
{
550555
$this->analyse([__DIR__ . '/data/bug-3920.php'], []);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug3631;
4+
5+
/**
6+
* @return array<string>
7+
*/
8+
function someFunc(bool $flag): array
9+
{
10+
$ids = [
11+
['fa', 'foo', 'baz']
12+
];
13+
14+
if ($flag) {
15+
$ids[] = ['foo', 'bar', 'baz'];
16+
17+
}
18+
19+
if (count($ids) > 1) {
20+
return array_intersect(...$ids);
21+
}
22+
23+
return $ids[0];
24+
}
25+
26+
var_dump(someFunc(true));
27+
var_dump(someFunc(false));

0 commit comments

Comments
 (0)