File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
tests/PHPStan/Rules/Properties Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -637,6 +637,11 @@ public function testGenericsInCallableInConstructor(): void
637
637
$ this ->analyse ([__DIR__ . '/data/generics-in-callable-in-constructor.php ' ], []);
638
638
}
639
639
640
+ public function testBug10686 (): void
641
+ {
642
+ $ this ->analyse ([__DIR__ . '/data/bug-10686.php ' ], []);
643
+ }
644
+
640
645
public function testBug11275 (): void
641
646
{
642
647
if (PHP_VERSION_ID < 80000 ) {
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Bug10686 ;
4
+
5
+ class Model {}
6
+
7
+ /**
8
+ * @template T of object|array<mixed>
9
+ */
10
+ class WeakAnalysingMap
11
+ {
12
+ /** @var list<T> */
13
+ public array $ values = [];
14
+ }
15
+
16
+ class Reference
17
+ {
18
+ /** @var WeakAnalysingMap<Model> */
19
+ private static WeakAnalysingMap $ analysingTheirModelMap ;
20
+
21
+ public function createAnalysingTheirModel (): Model
22
+ {
23
+ if ((self ::$ analysingTheirModelMap ?? null ) === null ) {
24
+ self ::$ analysingTheirModelMap = new WeakAnalysingMap ();
25
+ }
26
+
27
+ $ theirModel = new Model ();
28
+
29
+ self ::$ analysingTheirModelMap ->values [] = $ theirModel ;
30
+
31
+ return end (self ::$ analysingTheirModelMap ->values );
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments