Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Parent methods in extended EnumReflectionProperty didn't work. #342

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ parameters:
count: 1
path: src/Persistence/Mapping/Driver/StaticPHPDriver.php

-
message: "#^Doctrine\\\\Persistence\\\\Reflection\\\\EnumReflectionProperty\\:\\:__construct\\(\\) does not call parent constructor from ReflectionProperty\\.$#"
count: 1
path: src/Persistence/Reflection/EnumReflectionProperty.php

-
message: "#^Call to function method_exists\\(\\) with Doctrine\\\\Persistence\\\\Proxy and '__setInitialized' will always evaluate to true\\.$#"
count: 1
Expand Down
2 changes: 2 additions & 0 deletions src/Persistence/Reflection/EnumReflectionProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public function __construct(ReflectionProperty $originalReflectionProperty, stri
{
$this->originalReflectionProperty = $originalReflectionProperty;
$this->enumType = $enumType;

parent::__construct($originalReflectionProperty->class, $originalReflectionProperty->name);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ public function testSetValidArrayValue(): void
self::assertSame(['H', 'D'], $reflProperty->getValue($object));
self::assertSame([Suit::Hearts, Suit::Diamonds], $object->suits);
}

public function testParentReflectionPropertyMethods(): void
{
$reflProperty = new EnumReflectionProperty(new ReflectionProperty(TypedEnumClass::class, 'suit'), Suit::class);

self::assertIsArray($reflProperty->getAttributes());
self::assertIsInt($reflProperty->getModifiers());
}
}

class TypedEnumClass
Expand Down
Loading