Skip to content

Commit 2a1d06f

Browse files
[VarExporter] Fix exporting enums
1 parent 0acb1ec commit 2a1d06f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Internal/Exporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public static function export($value, string $indent = '')
198198
case true === $value: return 'true';
199199
case null === $value: return 'null';
200200
case '' === $value: return "''";
201-
case $value instanceof \UnitEnum: return ltrim(var_export($value, true), '\\');
201+
case $value instanceof \UnitEnum: return '\\'.ltrim(var_export($value, true), '\\');
202202
}
203203

204204
if ($value instanceof Reference) {

Tests/Fixtures/unit-enum.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22

33
return [
4-
Symfony\Component\VarExporter\Tests\Fixtures\FooUnitEnum::Bar,
4+
\Symfony\Component\VarExporter\Tests\Fixtures\FooUnitEnum::Bar,
55
];

0 commit comments

Comments
 (0)