Skip to content

Commit 3d43912

Browse files
committed
bugfix
Signed-off-by: alexmerlin <[email protected]>
1 parent 2a9bc5f commit 3d43912

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/App/src/DBAL/Types/AbstractEnumType.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use InvalidArgumentException;
1212

1313
use function array_map;
14-
use function assert;
1514
use function gettype;
1615
use function implode;
1716
use function is_object;
@@ -36,10 +35,7 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): mix
3635
return null;
3736
}
3837

39-
$enum = $this->getEnumClass();
40-
assert($enum instanceof BackedEnum);
41-
42-
return $enum::from($value);
38+
return $this->getEnumClass()::from($value);
4339
}
4440

4541
public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform): mixed
@@ -59,13 +55,13 @@ public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform)
5955
return $value->value;
6056
}
6157

58+
/**
59+
* @return class-string
60+
*/
6261
abstract protected function getEnumClass(): string;
6362

6463
private function getEnumValues(): array
6564
{
66-
$enum = $this->getEnumClass();
67-
assert($enum instanceof BackedEnum);
68-
69-
return $enum::cases();
65+
return $this->getEnumClass()::cases();
7066
}
7167
}

0 commit comments

Comments
 (0)