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 @@ -395,4 +395,11 @@ public function testBug7652(): void
395395 ]);
396396 }
397397
398+ public function testBug7103 (): void
399+ {
400+ $ this ->reportMaybes = true ;
401+ $ this ->reportStatic = true ;
402+ $ this ->analyse ([__DIR__ . '/data/bug-7103.php ' ], []);
403+ }
404+
398405}
Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Bug7103 ;
4+
5+ /**
6+ * @phpstan-template T of object
7+ */
8+ interface Manager
9+ {
10+ /**
11+ * @phpstan-template R of T
12+ * @param class-string<R> $class
13+ * @return R
14+ */
15+ public function find (string $ class , int $ id ): object ;
16+ }
17+
18+ interface Entity {}
19+
20+ /**
21+ * @phpstan-template T of Entity
22+ * @phpstan-implements Manager<T>
23+ */
24+ abstract class MyManager implements Manager
25+ {
26+ /**
27+ * @phpstan-template R of T
28+ * @phpstan-param class-string<R> $class
29+ * @phpstan-return R
30+ */
31+ public function find (string $ class , int $ id ): object
32+ {
33+ /** @phpstan-var R $object */
34+ $ object = $ this ->get ($ id );
35+
36+ return $ object ;
37+ }
38+
39+ abstract public function get (int $ id ): object ;
40+ }
You can’t perform that action at this time.
0 commit comments