File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed
tests/PHPStan/Rules/PhpDoc Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,10 @@ public function check(
140140continue ;
141141}
142142
143+ if ($ genericTypeVariance ->bivariant ()) {
144+ continue ;
145+ }
146+
143147$ messages [] = RuleErrorBuilder::message (sprintf (
144148$ typeIsNotSubtypeMessage ,
145149$ genericTypeType ->describe (VerbosityLevel::typeOnly ()),
Original file line number Diff line number Diff line change @@ -286,4 +286,9 @@ public function testParamOut(): void
286286]);
287287}
288288
289+ public function testBug10097 (): void
290+ {
291+ $ this ->analyse ([__DIR__ . '/data/bug-10097.php ' ], []);
292+ }
293+
289294}
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Bug10097 ;
4+
5+ interface SomeMessage {}
6+
7+ /**
8+ * @template T of object
9+ */
10+ interface Consumer
11+ {
12+ /**
13+ * @param T $message
14+ */
15+ public function process ($ message ): void ;
16+
17+ /**
18+ * @return class-string<T>
19+ */
20+ public function getMessageType (): string ;
21+ }
22+
23+
24+ /**
25+ * @extends Consumer<SomeMessage>
26+ */
27+ interface SomeMessageConsumer extends Consumer
28+ {
29+ }
30+
31+ /**
32+ * @return list<Consumer<*>>
33+ */
34+ function getConsumers (SomeMessageConsumer $ consumerA ): array
35+ {
36+ return [$ consumerA ];
37+ }
You can’t perform that action at this time.
0 commit comments