Skip to content

Commit

Permalink
fix: Handle enum as values
Browse files Browse the repository at this point in the history
  • Loading branch information
Geekimo committed Dec 28, 2021
1 parent 716eee9 commit da3cf3b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Util/ClassSourceManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,13 @@ private function quoteAnnotationValue($value)
throw new \Exception('Invalid value: loop before quoting.');
}

if (\PHP_VERSION_ID >= 80000) {
// do we have an enum ?
if (is_object($value) && enum_exists(get_class($value))) {
$value = $value->value;
}
}

return sprintf('"%s"', $value);
}

Expand Down

0 comments on commit da3cf3b

Please sign in to comment.