From 30c7a61a9b410f023c56ef19b9389a61647d8768 Mon Sep 17 00:00:00 2001 From: Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> Date: Thu, 16 Nov 2023 22:43:00 +0100 Subject: Use strict_types (#5830) * Little's optimisations and booleans in conditions * Apply strict type * Apply strict type * Apply strict type * Fix multiple bugs with PHP 8.2 and 8.3 * Many declares missing, more errors fixed * Apply strict type * Another approach * Stronger typing for Minz_Session * Fix case of SQLite --------- Co-authored-by: Luc Co-authored-by: Alexandre Alapetite --- cli/i18n/I18nFile.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'cli/i18n/I18nFile.php') diff --git a/cli/i18n/I18nFile.php b/cli/i18n/I18nFile.php index 5a0c74aaa..8932bff57 100644 --- a/cli/i18n/I18nFile.php +++ b/cli/i18n/I18nFile.php @@ -1,4 +1,5 @@ >> $i18n + * @param array>> $i18n */ public function dump(array $i18n): void { foreach ($i18n as $language => $file) { @@ -65,7 +66,7 @@ class I18nFile { } catch (ParseError $ex) { if (defined('STDERR')) { fwrite(STDERR, "Error while processing: $filename\n"); - fwrite(STDERR, $ex); + fwrite(STDERR, $ex->getMessage()); } die(1); } @@ -108,7 +109,7 @@ class I18nFile { * The first key is dropped since it represents the filename and we have * no use of it. * - * @param array $translation + * @param array $translation * @return array> */ private function unflatten(array $translation): array { @@ -118,7 +119,7 @@ class I18nFile { foreach ($translation as $compoundKey => $value) { $keys = explode('.', $compoundKey); array_shift($keys); - eval("\$a['" . implode("']['", $keys) . "'] = '" . addcslashes($value, "'") . "';"); + eval("\$a['" . implode("']['", $keys) . "'] = '" . addcslashes($value->__toString(), "'") . "';"); } return $a; @@ -131,7 +132,7 @@ class I18nFile { * translation file. The array is first converted to a string then some * formatting regexes are applied to match the original content. * - * @param array $translation + * @param array $translation */ private function format(array $translation): string { $translation = var_export($this->unflatten($translation), true); -- cgit v1.2.3