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 authored and jrushlow committed May 17, 2022
1 parent 090f40b commit 5b28174
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 @@ -512,6 +512,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 5b28174

Please sign in to comment.