Skip to content

Commit

Permalink
Merge pull request #352 from doctrine/3.3.x-merge-up-into-3.4.x_Lxo4D0l7
Browse files Browse the repository at this point in the history
Merge release 3.3.2 into 3.4.x
  • Loading branch information
malarzm authored Mar 12, 2024
2 parents 1878aac + 477da35 commit e32de47
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Persistence/Reflection/EnumReflectionProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
13 changes: 13 additions & 0 deletions tests_php81/Persistence/Reflection/EnumReflectionPropertyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -122,6 +134,7 @@ class MyAttribute

class TypedEnumClass
{
/** @MyDoc */
#[MyAttribute]
public ?Suit $suit = null;

Expand Down

0 comments on commit e32de47

Please sign in to comment.