File tree Expand file tree Collapse file tree
tests/PHPStan/Rules/Methods Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,19 +165,27 @@ public function testBug14549(): void
165165
166166 public function testRepeatedIterableTypeReportedOnce (): void
167167 {
168- // the same missing value type is reported once per parameter,
168+ // the same missing value type or generic class is reported once per parameter,
169169 // regardless of whether the occurrences share a Type instance (type alias) or not
170170 $ this ->analyse ([__DIR__ . '/data/bug-15350.php ' ], [
171171 [
172172 'Method Bug15350 \\Foo::inline() has parameter $a with no value type specified in iterable type array. ' ,
173- 14 ,
173+ 23 ,
174174 MissingTypehintCheck::MISSING_ITERABLE_VALUE_TYPE_TIP ,
175175 ],
176176 [
177177 'Method Bug15350 \\Foo::alias() has parameter $a with no value type specified in iterable type array. ' ,
178- 21 ,
178+ 30 ,
179179 MissingTypehintCheck::MISSING_ITERABLE_VALUE_TYPE_TIP ,
180180 ],
181+ [
182+ 'Method Bug15350 \\Foo::inlineGeneric() has parameter $a with generic class Bug15350 \\Box but does not specify its types: T ' ,
183+ 37 ,
184+ ],
185+ [
186+ 'Method Bug15350 \\Foo::aliasGeneric() has parameter $a with generic class Bug15350 \\Box but does not specify its types: T ' ,
187+ 44 ,
188+ ],
181189 ]);
182190 }
183191
Original file line number Diff line number Diff line change 22
33namespace Bug15350 ;
44
5+ /**
6+ * @template T
7+ */
8+ class Box
9+ {
10+
11+ }
12+
513/**
614 * @phpstan-type BareArr array
15+ * @phpstan-type BareBox Box
716 */
817class Foo
918{
@@ -22,4 +31,18 @@ public function alias($a): void
2231 {
2332 }
2433
34+ /**
35+ * @param callable(Box): Box $a
36+ */
37+ public function inlineGeneric ($ a ): void
38+ {
39+ }
40+
41+ /**
42+ * @param callable(BareBox): BareBox $a
43+ */
44+ public function aliasGeneric ($ a ): void
45+ {
46+ }
47+
2548}
You can’t perform that action at this time.
0 commit comments