From 4b7eeb2564c8c5b2f6ce999c7239e43c20da704b Mon Sep 17 00:00:00 2001 From: Daniel Klabbers Date: Mon, 27 Nov 2017 14:03:45 +0100 Subject: [PATCH] Using Core Translator in Locale Manager, type hinted its methods and removed unnecessary phpdoc --- framework/core/src/Locale/LocaleManager.php | 35 +++++++-------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/framework/core/src/Locale/LocaleManager.php b/framework/core/src/Locale/LocaleManager.php index 7bfa4b1eb..5fdd4d492 100644 --- a/framework/core/src/Locale/LocaleManager.php +++ b/framework/core/src/Locale/LocaleManager.php @@ -11,8 +11,6 @@ namespace Flarum\Locale; -use Illuminate\Contracts\Translation\Translator; - class LocaleManager { /** @@ -26,52 +24,49 @@ class LocaleManager protected $css = []; - /** - * @param Translator $translator - */ public function __construct(Translator $translator) { $this->translator = $translator; } - public function getLocale() + public function getLocale(): string { return $this->translator->getLocale(); } - public function setLocale($locale) + public function setLocale(string $locale) { $this->translator->setLocale($locale); } - public function addLocale($locale, $name) + public function addLocale(string $locale, string $name) { $this->locales[$locale] = $name; } - public function getLocales() + public function getLocales(): array { return $this->locales; } - public function hasLocale($locale) + public function hasLocale(string $locale): bool { return isset($this->locales[$locale]); } - public function addTranslations($locale, $file, $module = null) + public function addTranslations(string $locale, $file, string $module = null) { $prefix = $module ? $module.'::' : ''; $this->translator->addResource('prefixed_yaml', compact('file', 'prefix'), $locale); } - public function addJsFile($locale, $js) + public function addJsFile(string $locale, string $js) { $this->js[$locale][] = $js; } - public function getJsFiles($locale) + public function getJsFiles(string $locale): array { $files = array_get($this->js, $locale, []); @@ -84,12 +79,12 @@ class LocaleManager return $files; } - public function addCssFile($locale, $css) + public function addCssFile(string $locale, string $css) { $this->css[$locale][] = $css; } - public function getCssFiles($locale) + public function getCssFiles(string $locale): array { $files = array_get($this->css, $locale, []); @@ -102,18 +97,12 @@ class LocaleManager return $files; } - /** - * @return SymfonyTranslator - */ - public function getTranslator() + public function getTranslator(): Translator { return $this->translator; } - /** - * @param SymfonyTranslator $translator - */ - public function setTranslator(SymfonyTranslator $translator) + public function setTranslator(Translator $translator) { $this->translator = $translator; }