Skip to content

Commit 5bda659

Browse files
committed
Add another regression test
1 parent f340663 commit 5bda659

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
@@ -531,6 +531,11 @@ public function testBug3608(): void
531531
$this->analyse([__DIR__ . '/data/bug-3608.php'], []);
532532
}
533533

534+
public function testBug3631(): void
535+
{
536+
$this->analyse([__DIR__ . '/data/bug-3631.php'], []);
537+
}
538+
534539
public function testBug3920(): void
535540
{
536541
$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)