8000 [CSM] fix: Handle enum as values (#1042) · symfony/maker-bundle@e09a55b · GitHub
[go: up one dir, main page]

Skip to content

Commit e09a55b

Browse files
Geekimoweaverryanjrushlow
authored
[CSM] fix: Handle enum as values (#1042)
Co-authored-by: Ryan Weaver <weaverryan+github@gmail.com> Co-authored-by: Jesse Rushlow <jr@rushlow.dev>
1 parent 090f40b commit e09a55b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Util/ClassSourceManipulator.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,13 @@ private function quoteAnnotationValue($value)
512512
throw new \Exception('Invalid value: loop before quoting.');
513513
}
514514

515+
if (\function_exists('enum_exists')) {
516+
// do we have an enum ?
517+
if (\is_object($value) && enum_exists(\get_class($value))) {
518+
$value = $value->value;
519+
}
520+
}
521+
515522
return sprintf('"%s"', $value);
516523
}
517524

0 commit comments

Comments
 (0)
0