From 2a1d06fcf2b30829d6c01dae8e6e188424d1f8f6 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 12 Jan 2023 17:39:29 +0100 Subject: [PATCH] [VarExporter] Fix exporting enums --- Internal/Exporter.php | 2 +- Tests/Fixtures/unit-enum.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Internal/Exporter.php b/Internal/Exporter.php index f4e5746..6ee3ee7 100644 --- a/Internal/Exporter.php +++ b/Internal/Exporter.php @@ -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) { diff --git a/Tests/Fixtures/unit-enum.php b/Tests/Fixtures/unit-enum.php index 48ab51d..98bc122 100644 --- a/Tests/Fixtures/unit-enum.php +++ b/Tests/Fixtures/unit-enum.php @@ -1,5 +1,5 @@