Skip to content

Commit 7eded76

Browse files
minor symfony#50955 [Intl] Use VarExporter::export() in PhpBundleWriter (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- [Intl] Use VarExporter::export() in PhpBundleWriter | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - As suggested by `@stof` in https://github.com/symfony/symfony/pull/50943/files#r1260782250 Commits ------- 5abcf43 [Intl] Use VarExporter::export() in PhpBundleWriter
2 parents 8e93517 + 5abcf43 commit 7eded76

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

src/Symfony/Component/Intl/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)