Skip to content

Commit a22e032

Browse files
author
marius
committed
Test phpstan stuff
1 parent 40f66c4 commit a22e032

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/Type/Definition/EnumType.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,13 @@ public function getValues(): array
132132
public function serialize($value)
133133
{
134134
$lookup = $this->getValueLookup();
135-
if ($value instanceof \BackedEnum) {
136-
$value = $value->value;
137-
} elseif ($value instanceof \UnitEnum) {
138-
$value = $value->name;
135+
136+
if (class_exists(\BackedEnum::class)) {
137+
if ($value instanceof \BackedEnum) {
138+
$value = $value->value;
139+
} elseif ($value instanceof \UnitEnum) {
140+
$value = $value->name;
141+
}
139142
}
140143
if (isset($lookup[$value])) {
141144
return $lookup[$value]->name;

0 commit comments

Comments
 (0)