We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 802fa6e commit c6d4e32Copy full SHA for c6d4e32
tests/PHPStan/Rules/Arrays/InvalidKeyInArrayDimFetchRuleTest.php
@@ -106,4 +106,14 @@ public function testBug13135(): void
106
]);
107
}
108
109
+ public function testBug12273(): void
110
+ {
111
+ $this->analyse([__DIR__ . '/data/bug-12273.php'], [
112
+ [
113
+ 'Possibly invalid array key type mixed.',
114
+ 16,
115
+ ],
116
+ ]);
117
+ }
118
+
119
tests/PHPStan/Rules/Arrays/data/bug-12273.php
@@ -0,0 +1,17 @@
1
+<?php
2
3
+namespace Bug12273;
4
5
+function doFoo():void {
6
+ $map = [
7
+ 'datetime' => \DateTime::class,
8
+ 'stdclass' => \stdClass::class,
9
+ ];
10
11
+ $settings = json_decode('{"class": "datetim"}');
12
13
+ \PHPStan\dumpType($map);
14
+ \PHPStan\dumpType($settings->class);
15
16
+ new ($map[$settings->class])();
17
+}
0 commit comments