From f0d755620053b6ede3fa0ffd94b5232a92630f9b Mon Sep 17 00:00:00 2001 From: Ricardo Boss Date: Mon, 20 Dec 2021 23:20:50 +0100 Subject: [PATCH] Added pure annotations to enum functions --- stubs/Php81.phpstub | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/stubs/Php81.phpstub b/stubs/Php81.phpstub index 7bf17a73b..04b4b6008 100644 --- a/stubs/Php81.phpstub +++ b/stubs/Php81.phpstub @@ -4,14 +4,25 @@ namespace { /** @var non-empty-string $name */ public readonly string $name; - /** @return non-empty-list */ + /** + * @psalm-pure + * @return non-empty-list + */ public static function cases(): array; } interface BackedEnum { public readonly int|string $value; + + /** + * @psalm-pure + */ public static function from(string|int $value): static; + + /** + * @psalm-pure + */ public static function tryFrom(string|int $value): ?static; } @@ -27,12 +38,22 @@ namespace { class ReflectionEnumUnitCase extends ReflectionClassConstant implements Reflector { + /** + * @psalm-pure + */ public function getEnum(): ReflectionEnum; + + /** + * @psalm-pure + */ public function getValue(): UnitEnum; } class ReflectionEnumBackedCase extends ReflectionEnumUnitCase implements Reflector { + /** + * @psalm-pure + */ public function getBackingValue(): int|string; } }