Skip to content

Commit 964caf8

Browse files
tjveldhuizenondrejmirtes
authored andcommitted
Fix type for enumType in ClassMetaData
Since the ClassMetadataInfo-class is namespaced, the BackedEnum-reference should be prefixed with a back slash. Without it, the type of `enumType` becomes `Doctrine\ORM\Mapping\BackedEnum` which is invalid.
1 parent 5080276 commit 964caf8

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/Type/Doctrine/Query/QueryResultTypeWalker.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
use function is_numeric;
4646
use function is_object;
4747
use function is_string;
48-
use function is_subclass_of;
4948
use function serialize;
5049
use function sprintf;
5150
use function strtolower;
@@ -1300,7 +1299,7 @@ private function getTypeOfField(ClassMetadataInfo $class, string $fieldName): ar
13001299
$type = $metadata['type'];
13011300
$enumType = $metadata['enumType'] ?? null;
13021301

1303-
if (!is_string($enumType) || !class_exists($enumType) || !is_subclass_of($enumType, BackedEnum::class)) {
1302+
if (!is_string($enumType) || !class_exists($enumType)) {
13041303
$enumType = null;
13051304
}
13061305

stubs/ORM/Mapping/ClassMetadataInfo.stub

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use ReflectionClass;
1818
* notInsertable?: bool,
1919
* notUpdatable?: bool,
2020
* generated?: int,
21-
* enumType?: class-string<BackedEnum>,
21+
* enumType?: class-string<\BackedEnum>,
2222
* columnDefinition?: string,
2323
* precision?: int,
2424
* scale?: int,

0 commit comments

Comments
 (0)