Skip to content

Commit b8f2d5d

Browse files
rvanvelzenondrejmirtes
authored andcommitted
Regression test
1 parent 7430930 commit b8f2d5d

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

tests/PHPStan/Rules/Methods/MethodSignatureRuleTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
}

0 commit comments

Comments
 (0)