aboutsummaryrefslogtreecommitdiff
path: root/cli/i18n/I18nFile.php
diff options
context:
space:
mode:
authorGravatar Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> 2024-06-05 22:04:06 +0200
committerGravatar GitHub <noreply@github.com> 2024-06-05 22:04:06 +0200
commitf99c8d5f54c67e0abc3f3189b4f5e3e4571e114c (patch)
treed7d74a628cd9614dd4093220139b6c073f3a5c54 /cli/i18n/I18nFile.php
parent8fc8ac3aefca73a4cd509313a2f1ad73ef7f2e1a (diff)
Modernize code to php7.4 (#6043)
* Modernize code to php7.4 * Modernize code to php7.4 * Modernize code to php7.4 * Modernize code to php7.4 * Modernize code to php7.4 * Modernize code to php7.4 * Modernize code to php7.4 * Modernize code to php7.4 * Modernize code to php7.4 * Modernize code to php7.4 * Modernize code to php7.4 * Modernize code to php7.4 * Modernize code to php7.4 * Consistency --------- Co-authored-by: Luc <sanchezluc+freshrss@gmail.com> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'cli/i18n/I18nFile.php')
-rw-r--r--cli/i18n/I18nFile.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/cli/i18n/I18nFile.php b/cli/i18n/I18nFile.php
index 8932bff57..8085164c5 100644
--- a/cli/i18n/I18nFile.php
+++ b/cli/i18n/I18nFile.php
@@ -8,7 +8,7 @@ class I18nFile {
* @return array<string,array<string,array<string,I18nValue>>>
*/
public function load(): array {
- $i18n = array();
+ $i18n = [];
$dirs = new DirectoryIterator(I18N_PATH);
foreach ($dirs as $dir) {
if ($dir->isDot()) {
@@ -86,7 +86,7 @@ class I18nFile {
* @return array<string,I18nValue>
*/
private function flatten(array $translation, string $prefix = ''): array {
- $a = array();
+ $a = [];
if ('' !== $prefix) {
$prefix .= '.';
@@ -113,7 +113,7 @@ class I18nFile {
* @return array<string,array<string,I18nValue>>
*/
private function unflatten(array $translation): array {
- $a = array();
+ $a = [];
ksort($translation, SORT_NATURAL);
foreach ($translation as $compoundKey => $value) {
@@ -136,7 +136,7 @@ class I18nFile {
*/
private function format(array $translation): string {
$translation = var_export($this->unflatten($translation), true);
- $patterns = array(
+ $patterns = [
'/ -> todo\',/',
'/ -> dirty\',/',
'/ -> ignore\',/',
@@ -144,8 +144,8 @@ class I18nFile {
'/=>\s*array/',
'/(\w) {2}/',
'/ {2}/',
- );
- $replacements = array(
+ ];
+ $replacements = [
"',\t// TODO", // Double quoting is mandatory to have a tab instead of the \t string
"',\t// DIRTY", // Double quoting is mandatory to have a tab instead of the \t string
"',\t// IGNORE", // Double quoting is mandatory to have a tab instead of the \t string
@@ -153,7 +153,7 @@ class I18nFile {
'=> array',
'$1 ',
"\t", // Double quoting is mandatory to have a tab instead of the \t string
- );
+ ];
$translation = preg_replace($patterns, $replacements, $translation);
return <<<OUTPUT