File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,12 @@ namespace {
2626 * @psalm-pure
2727 */
2828 public static function tryFrom(string|int $value): ?static;
29+
30+ /**
31+ * @psalm-pure
32+ * @return list<static>
33+ */
34+ public static function cases(): array;
2935 }
3036
3137 class ReflectionClass implements Reflector {
Original file line number Diff line number Diff line change @@ -453,6 +453,22 @@ enum Test: string
453453 'ignored_issues ' => [],
454454 'php_version ' => '8.1 ' ,
455455 ],
456+ 'methodInheritanceByInterfaces ' => [
457+ 'code ' => '<?php
458+ interface I extends BackedEnum {}
459+ /** @var I $i */
460+ $a = $i::cases();
461+ $b = $i::from(1);
462+ $c = $i::tryFrom(2);
463+ ' ,
464+ 'assertions ' => [
465+ '$a=== ' => 'list<I> ' ,
466+ '$b=== ' => 'I ' ,
467+ '$c=== ' => 'I|null ' ,
468+ ],
469+ 'ignored_issues ' => [],
470+ 'php_version ' => '8.1 ' ,
471+ ],
456472 ];
457473 }
458474
You can’t perform that action at this time.
0 commit comments