Skip to content

Commit

Permalink
Merge pull request #357 from Goazil/fix-enum-private-reflection
Browse files Browse the repository at this point in the history
fix: Failing to retrieve reflection property on enum
  • Loading branch information
greg0ire authored May 17, 2024
2 parents aedc664 + 39ddc95 commit 267cd9f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Persistence/Reflection/EnumReflectionProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,14 @@ public function getDocComment(): string|false
{
return $this->originalReflectionProperty->getDocComment();
}

/**
* {@inheritDoc}
*
* @psalm-external-mutation-free
*/
public function isPrivate(): bool
{
return $this->originalReflectionProperty->isPrivate();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ public function testGetDocComment(): void
$reflProperty = new EnumReflectionProperty(new ReflectionProperty(TypedEnumClass::class, 'suit'), Suit::class);
self::assertStringContainsString('@MyDoc', $reflProperty->getDocComment());
}

public function testIsPrivate(): void
{
$reflProperty = new EnumReflectionProperty(new ReflectionProperty(TypedEnumClass::class, 'suit'), Suit::class);
self::assertFalse($reflProperty->isPrivate());
}
}

#[Attribute(Attribute::TARGET_PROPERTY)]
Expand Down

0 comments on commit 267cd9f

Please sign in to comment.