Skip to content

Commit ab4906a

Browse files
phpstan-botclaude
andcommitted
Merge NSRT and TooWidePropertyTypeRule test files for bug-11844 into a single shared file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f7f4c95 commit ab4906a

File tree

3 files changed

+9
-102
lines changed

3 files changed

+9
-102
lines changed

tests/PHPStan/Analyser/NodeScopeResolverTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ private static function findTestFiles(): iterable
263263
yield __DIR__ . '/../Rules/Variables/data/bug-14124.php';
264264
yield __DIR__ . '/../Rules/Variables/data/bug-14124b.php';
265265
yield __DIR__ . '/../Rules/Arrays/data/bug-14308.php';
266+
yield __DIR__ . '/../Rules/TooWideTypehints/data/bug-11844.php';
266267
}
267268

268269
/**

tests/PHPStan/Analyser/nsrt/bug-11844.php

Lines changed: 0 additions & 102 deletions
This file was deleted.

tests/PHPStan/Rules/TooWideTypehints/data/bug-11844.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Bug11844;
66

7+
use function PHPStan\Testing\assertType;
8+
79
class StaticPropertyCase
810
{
911
/**
@@ -15,6 +17,7 @@ public static function init(): void
1517
{
1618
if (self::$map === null) {
1719
self::$map = new \WeakMap();
20+
assertType('WeakMap<object, string>', self::$map);
1821
}
1922
}
2023
}
@@ -30,6 +33,7 @@ public function init(): void
3033
{
3134
if ($this->map === null) {
3235
$this->map = new \WeakMap();
36+
assertType('WeakMap<object, string>', $this->map);
3337
}
3438
}
3539
}
@@ -58,6 +62,7 @@ public function init(): void
5862
if ($this->map !== false) {
5963
if ($this->map === null) {
6064
$this->map = new \WeakMap();
65+
assertType('WeakMap<object, string>', $this->map);
6166
}
6267
}
6368
}
@@ -80,6 +85,7 @@ public static function init(): void
8085
if (self::$map !== false) {
8186
if (self::$map === null) {
8287
self::$map = new \WeakMap();
88+
assertType('WeakMap<object, string>', self::$map);
8389
}
8490
}
8591
}
@@ -120,6 +126,7 @@ public function init(): void
120126
{
121127
if ($this->map === null) {
122128
$this->map = new \WeakMap();
129+
assertType('WeakMap<T of object (class Bug11844\TemplatePropertyCase, argument), U (class Bug11844\TemplatePropertyCase, argument)>', $this->map);
123130
}
124131
}
125132
}
@@ -139,6 +146,7 @@ public static function init(): void
139146
{
140147
if (self::$map === null) {
141148
self::$map = new \WeakMap();
149+
assertType('WeakMap<T of object (class Bug11844\StaticTemplatePropertyCase, argument), U (class Bug11844\StaticTemplatePropertyCase, argument)>', self::$map);
142150
}
143151
}
144152
}

0 commit comments

Comments
 (0)