Skip to content

Commit d5312c0

Browse files
committed
Regression test
Closes phpstan/phpstan#9657
1 parent 49c631a commit d5312c0

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

Diff for: tests/PHPStan/Rules/Methods/MissingMethodReturnTypehintRuleTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PHPStan\Rules\MissingTypehintCheck;
66
use PHPStan\Rules\Rule;
77
use PHPStan\Testing\RuleTestCase;
8+
use const PHP_VERSION_ID;
89

910
/**
1011
* @extends RuleTestCase<MissingMethodReturnTypehintRule>
@@ -111,4 +112,13 @@ public function testGenericStatic(): void
111112
]);
112113
}
113114

115+
public function testBug9657(): void
116+
{
117+
if (PHP_VERSION_ID < 80000) {
118+
$this->markTestSkipped('Test requires PHP 8.0');
119+
}
120+
121+
$this->analyse([__DIR__ . '/data/bug-9657.php'], []);
122+
}
123+
114124
}

Diff for: tests/PHPStan/Rules/Methods/data/bug-9657.php

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php // lint >= 8.0
2+
3+
namespace Bug9657;
4+
5+
/**
6+
* @template T
7+
*/
8+
trait Convertable
9+
{
10+
/**
11+
* @return T
12+
*/
13+
abstract public function toOther(): mixed;
14+
}
15+
16+
final class Thing
17+
{
18+
/** @use Convertable<list<never>> */
19+
use Convertable;
20+
21+
public function toOther(): array
22+
{
23+
return [];
24+
}
25+
}

0 commit comments

Comments
 (0)