diff --git a/src/HasTranslations.php b/src/HasTranslations.php index f61a328..93e1396 100644 --- a/src/HasTranslations.php +++ b/src/HasTranslations.php @@ -112,7 +112,7 @@ public function getTranslationWithoutFallback(string $key, string $locale): mixe return $this->getTranslation($key, $locale, false); } - public function getTranslations(string $key = null, array $allowedLocales = null): array + public function getTranslations(?string $key = null, ?array $allowedLocales = null): array { if ($key !== null) { $this->guardAgainstNonTranslatableAttribute($key); @@ -223,7 +223,7 @@ public function isTranslatableAttribute(string $key): bool return in_array($key, $this->getTranslatableAttributes()); } - public function hasTranslation(string $key, string $locale = null): bool + public function hasTranslation(string $key, ?string $locale = null): bool { $locale = $locale ?: $this->getLocale(); @@ -279,7 +279,7 @@ protected function normalizeLocale(string $key, string $locale, bool $useFallbac return $locale; } - protected function filterTranslations(mixed $value = null, string $locale = null, array $allowedLocales = null): bool + protected function filterTranslations(mixed $value = null, ?string $locale = null, ?array $allowedLocales = null): bool { if ($value === null) { return false; diff --git a/src/Translatable.php b/src/Translatable.php index 18df5d8..797828d 100644 --- a/src/Translatable.php +++ b/src/Translatable.php @@ -22,7 +22,7 @@ class Translatable public function fallback( ?string $fallbackLocale = null, ?bool $fallbackAny = false, - $missingKeyCallback = null + ?Closure $missingKeyCallback = null ): self { $this->fallbackLocale = $fallbackLocale; $this->fallbackAny = $fallbackAny;