From 4fcf013f3c4c90656a09894feb26271b8c88714b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Mi=C5=A1o=20=C4=8Cerve=C5=88=C3=A1k?= Date: Mon, 31 Jul 2023 20:26:05 +0200 Subject: [PATCH] LocalizedString --- src/Localization/LocalizedString.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Localization/LocalizedString.php b/src/Localization/LocalizedString.php index 7901db0..18235b0 100644 --- a/src/Localization/LocalizedString.php +++ b/src/Localization/LocalizedString.php @@ -4,31 +4,43 @@ namespace Fykosak\Utils\Localization; +/** + * @template L of string + */ class LocalizedString { /** - * @phpstan-var array + * @phpstan-var array */ private array $texts; /** - * @phpstan-param array $texts + * @phpstan-param array $texts */ public function __construct(array $texts) { $this->texts = $texts; } + /** + * @phpstan-param L $lang + */ public function __get(string $lang): ?string { return $this->getText($lang); } + /** + * @phpstan-param L $lang + */ public function getText(string $lang): ?string { return $this->texts[$lang] ?? null; } + /** + * @phpstan-return array + */ public function __serialize(): array { return $this->texts;