File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
tests/PHPStan/Rules/Functions Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -307,6 +307,11 @@ public function testBug9614(): void
307
307
$ this ->analyse ([__DIR__ . '/data/bug-9614.php ' ], []);
308
308
}
309
309
310
+ public function testBug3616 (): void
311
+ {
312
+ $ this ->analyse ([__DIR__ . '/data/bug-3616.php ' ], []);
313
+ }
314
+
310
315
public function testBug10814 (): void
311
316
{
312
317
$ this ->analyse ([__DIR__ . '/data/bug-10814.php ' ], [
Original file line number Diff line number Diff line change
1
+ <?php declare (strict_types = 1 );
2
+
3
+ namespace Bug3616 ;
4
+
5
+ class Factory {
6
+ public static function a (): void { echo 'A ' ; }
7
+ public static function b (): void { echo 'B ' ; }
8
+ }
9
+
10
+ class HelloWorld
11
+ {
12
+ /** @var array<string, callable():void> */
13
+ const FACTORIES = [
14
+ 'a ' => [Factory::class, 'a ' ],
15
+ 'b ' => [Factory::class, 'b ' ]
16
+ ];
17
+
18
+ public function withLiteral (): void
19
+ {
20
+ (self ::FACTORIES ['a ' ])();
21
+ }
22
+
23
+ public function withVariable (string $ id ): void
24
+ {
25
+ if (!isset (self ::FACTORIES [$ id ])) {
26
+ return ;
27
+ }
28
+
29
+ (self ::FACTORIES [$ id ])();
30
+ }
31
+ }
You can’t perform that action at this time.
0 commit comments