Skip to content

Commit b0807a5

Browse files
Add test
1 parent 83a0511 commit b0807a5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/PHPStan/Rules/Functions/data/bug-3616.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,25 @@ public function withVariable(string $id): void
2929
(self::FACTORIES[$id])();
3030
}
3131
}
32+
33+
class HelloWorld2
34+
{
35+
const FACTORIES = [
36+
'a' => [Factory::class, 'a'],
37+
'b' => [Factory::class, 'b']
38+
];
39+
40+
public function withLiteral(): void
41+
{
42+
(self::FACTORIES['a'])();
43+
}
44+
45+
public function withVariable(string $id): void
46+
{
47+
if (!isset(self::FACTORIES[$id])) {
48+
return;
49+
}
50+
51+
(self::FACTORIES[$id])();
52+
}
53+
}

0 commit comments

Comments
 (0)