Skip to content

Commit 672fa62

Browse files
[Intl] Use VarExporter::export() in PhpBundleWriter
1 parent 4c4cbf5 commit 672fa62

File tree

515 files changed

+58192
-58344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

515 files changed

+58192
-58344
lines changed

Data/Bundle/Writer/PhpBundleWriter.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Intl\Data\Bundle\Writer;
1313

14+
use Symfony\Component\VarExporter\VarExporter;
15+
1416
/**
1517
* Writes .php resource bundles.
1618
*
@@ -42,14 +44,6 @@ public function write(string $path, string $locale, $data)
4244
}
4345
});
4446

45-
$data = var_export($data, true);
46-
$data = preg_replace('/array \(/', '[', $data);
47-
$data = preg_replace('/\n {1,10}\[/', '[', $data);
48-
$data = preg_replace('/ /', ' ', $data);
49-
$data = preg_replace('/\),$/m', '],', $data);
50-
$data = preg_replace('/\)$/', ']', $data);
51-
$data = sprintf($template, $data);
52-
53-
file_put_contents($path.'/'.$locale.'.php', $data);
47+
file_put_contents($path.'/'.$locale.'.php', sprintf($template, VarExporter::export($data)));
5448
}
5549
}

0 commit comments

Comments
 (0)