Skip to content

Commit 3226e26

Browse files
committed
using ReflectionEnum instead
1 parent 70a1248 commit 3226e26

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Doctrine/ORM/Tools/SchemaValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Doctrine\ORM\EntityManagerInterface;
2323
use Doctrine\ORM\Mapping\ClassMetadata;
2424
use Doctrine\ORM\Mapping\ClassMetadataInfo;
25+
use ReflectionEnum;
2526
use ReflectionNamedType;
2627

2728
use function array_diff;
@@ -36,7 +37,6 @@
3637
use function class_parents;
3738
use function count;
3839
use function get_class;
39-
use function get_debug_type;
4040
use function implode;
4141
use function in_array;
4242
use function is_a;
@@ -391,7 +391,7 @@ function (array $fieldMapping) use ($class): ?string {
391391

392392
if (
393393
is_a($propertyType, BackedEnum::class, true)
394-
&& $metadataFieldType === get_debug_type($propertyType::cases()[0]->value)
394+
&& $metadataFieldType === (string) (new ReflectionEnum($propertyType))->getBackingType()
395395
) {
396396
if (! isset($fieldMapping['enumType']) || $propertyType === $fieldMapping['enumType']) {
397397
return null;

0 commit comments

Comments
 (0)