Skip to content

Commit

Permalink
[VarExporter] Fix exporting enums
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Jan 12, 2023
1 parent 0acb1ec commit 2a1d06f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Internal/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public static function export($value, string $indent = '')
case true === $value: return 'true';
case null === $value: return 'null';
case '' === $value: return "''";
case $value instanceof \UnitEnum: return ltrim(var_export($value, true), '\\');
case $value instanceof \UnitEnum: return '\\'.ltrim(var_export($value, true), '\\');
}

if ($value instanceof Reference) {
Expand Down
2 changes: 1 addition & 1 deletion Tests/Fixtures/unit-enum.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

return [
Symfony\Component\VarExporter\Tests\Fixtures\FooUnitEnum::Bar,
\Symfony\Component\VarExporter\Tests\Fixtures\FooUnitEnum::Bar,
];

0 comments on commit 2a1d06f

Please sign in to comment.