mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
fix I::cases()
where interface I extends BackedEnum
Fixes vimeo/psalm#9065 Inheritance in stubs seems to be broken
This commit is contained in:
parent
8329309999
commit
afb8c8891b
@ -26,6 +26,12 @@ namespace {
|
||||
* @psalm-pure
|
||||
*/
|
||||
public static function tryFrom(string|int $value): ?static;
|
||||
|
||||
/**
|
||||
* @psalm-pure
|
||||
* @return list<static>
|
||||
*/
|
||||
public static function cases(): array;
|
||||
}
|
||||
|
||||
class ReflectionClass implements Reflector {
|
||||
|
@ -453,6 +453,22 @@ class EnumTest extends TestCase
|
||||
'ignored_issues' => [],
|
||||
'php_version' => '8.1',
|
||||
],
|
||||
'methodInheritanceByInterfaces' => [
|
||||
'code' => '<?php
|
||||
interface I extends BackedEnum {}
|
||||
/** @var I $i */
|
||||
$a = $i::cases();
|
||||
$b = $i::from(1);
|
||||
$c = $i::tryFrom(2);
|
||||
',
|
||||
'assertions' => [
|
||||
'$a===' => 'list<I>',
|
||||
'$b===' => 'I',
|
||||
'$c===' => 'I|null',
|
||||
],
|
||||
'ignored_issues' => [],
|
||||
'php_version' => '8.1',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user