From 15745d42b779ad14efde2932ab116f45eee39246 Mon Sep 17 00:00:00 2001 From: Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> Date: Thu, 28 Nov 2024 17:11:04 +0100 Subject: Upgrade code to php 8.1 (#6748) * revert Fix code indentation Fix code Upgrade code to php 8.1 * fix remarques * code review * code review * code review * Apply suggestions from code review * code review * Fixes * Many remainging updates of array syntax * Lost case 'reading-list' * Uneeded PHPDoc --------- Co-authored-by: Luc Sanchez Co-authored-by: Alexandre Alapetite --- cli/i18n/I18nData.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'cli/i18n/I18nData.php') diff --git a/cli/i18n/I18nData.php b/cli/i18n/I18nData.php index 6d5730a08..6f841e947 100644 --- a/cli/i18n/I18nData.php +++ b/cli/i18n/I18nData.php @@ -5,13 +5,8 @@ class I18nData { public const REFERENCE_LANGUAGE = 'en'; - /** @var array>> */ - private array $data; - /** @param array>> $data */ - public function __construct(array $data) { - $this->data = $data; - + public function __construct(private array $data) { $this->addMissingKeysFromReference(); $this->removeExtraKeysFromOtherLanguages(); $this->processValueStates(); @@ -144,7 +139,7 @@ class I18nData { $keys = array_keys($this->data[static::REFERENCE_LANGUAGE][$this->getFilenamePrefix($key)]); $parent = $this->getParentKey($key); - return array_values(array_filter($keys, static fn(string $element) => false !== strpos($element, $parent))); + return array_values(array_filter($keys, static fn(string $element) => str_contains($element, $parent))); } /** @@ -185,7 +180,7 @@ class I18nData { if ($element === $key) { return false; } - return false !== strpos($element, $key); + return str_contains($element, $key); })); return count($children) !== 0; -- cgit v1.2.3