diff --git a/src/Persistence/Reflection/EnumReflectionProperty.php b/src/Persistence/Reflection/EnumReflectionProperty.php index fd994f47..0ea9098d 100644 --- a/src/Persistence/Reflection/EnumReflectionProperty.php +++ b/src/Persistence/Reflection/EnumReflectionProperty.php @@ -148,4 +148,24 @@ private function toEnum($value) return $this->enumType::from($value); } + + /** + * {@inheritDoc} + * + * @psalm-external-mutation-free + */ + public function getModifiers(): int + { + return $this->originalReflectionProperty->getModifiers(); + } + + /** + * {@inheritDoc} + * + * @psalm-external-mutation-free + */ + public function getDocComment(): string|false + { + return $this->originalReflectionProperty->getDocComment(); + } } diff --git a/tests_php81/Persistence/Reflection/EnumReflectionPropertyTest.php b/tests_php81/Persistence/Reflection/EnumReflectionPropertyTest.php index a5f2b6f6..fead5f60 100644 --- a/tests_php81/Persistence/Reflection/EnumReflectionPropertyTest.php +++ b/tests_php81/Persistence/Reflection/EnumReflectionPropertyTest.php @@ -113,6 +113,18 @@ public function testSetEnumArray(): void self::assertSame([Suit::Hearts, Suit::Diamonds], $object->suits); } + + public function testGetModifiers(): void + { + $reflProperty = new EnumReflectionProperty(new ReflectionProperty(TypedEnumClass::class, 'suit'), Suit::class); + self::assertSame(ReflectionProperty::IS_PUBLIC, $reflProperty->getModifiers()); + } + + public function testGetDocComment(): void + { + $reflProperty = new EnumReflectionProperty(new ReflectionProperty(TypedEnumClass::class, 'suit'), Suit::class); + self::assertStringContainsString('@MyDoc', $reflProperty->getDocComment()); + } } #[Attribute(Attribute::TARGET_PROPERTY)] @@ -122,6 +134,7 @@ class MyAttribute class TypedEnumClass { + /** @MyDoc */ #[MyAttribute] public ?Suit $suit = null;