File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,12 @@ public function testExtendsPdoStatementCrash(): void
153
153
$ this ->assertNoErrors ($ errors );
154
154
}
155
155
156
+ public function testBug12803 (): void
157
+ {
158
+ $ errors = $ this ->runAnalyse (__DIR__ . '/data/bug-12803.php ' );
159
+ $ this ->assertNoErrors ($ errors );
160
+ }
161
+
156
162
public function testArrayDestructuringArrayDimFetch (): void
157
163
{
158
164
$ errors = $ this ->runAnalyse (__DIR__ . '/data/array-destructuring-array-dim-fetch.php ' );
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Bug12803 ;
4
+
5
+ /** @template T */
6
+ class Generic {}
7
+
8
+ class A
9
+ {
10
+ /** @param array{foo: int, bar: string} $foo */
11
+ public function b (array $ foo ): void
12
+ {
13
+ /** @var Generic<object{foo: 2, bar: 1}> $a */
14
+ $ a = $ this ->c (fn () => (object ) ['bar ' => 1 , 'foo ' => 2 ]);
15
+ $ b = $ this ->c (fn () => (object ) ['bar ' => 1 , 'foo ' => 2 ]);
16
+ }
17
+
18
+ /**
19
+ * @template T
20
+ * @param callable(): T $callback
21
+ * @return Generic<T>
22
+ */
23
+ public function c (callable $ callback ): Generic
24
+ {
25
+ return new Generic ();
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments