Skip to content

Commit

Permalink
Merge pull request #42 from Laravel-Lang/2.x
Browse files Browse the repository at this point in the history
Typing error fixed
  • Loading branch information
andrey-helldar authored Jun 22, 2024
2 parents 704485c + 871db9a commit e9a62ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Services/RawLocales.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function isAvailable(Locale|LocaleData|string|null $locale): bool
|| $this->inArray($this->fromAlias($locale), $locales);
}

public function isInstalled(Locale|string|null $locale): bool
public function isInstalled(Locale|LocaleData|string|null $locale): bool
{
return $this->registry([__METHOD__, $locale], function () use ($locale) {
$locales = $this->installed();
Expand All @@ -101,7 +101,7 @@ public function isInstalled(Locale|string|null $locale): bool
});
}

public function isProtected(Locale|string|null $locale): bool
public function isProtected(Locale|LocaleData|string|null $locale): bool
{
return $this->registry([__METHOD__, $locale], function () use ($locale) {
$locales = $this->protects();
Expand Down Expand Up @@ -170,7 +170,7 @@ public function info(mixed $locale): string
});
}

protected function inArray(Locale|string|null $locale, array $haystack): bool
protected function inArray(Locale|LocaleData|string|null $locale, array $haystack): bool
{
$locale = Resolver::toString($locale);

Expand Down
6 changes: 5 additions & 1 deletion src/Services/Resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ public static function fromMixed(mixed $locale): ?string
return static::toString((string) $locale);
}

public static function toString(Locale|string|null $locale): ?string
public static function toString(Locale|LocaleData|string|null $locale): ?string
{
if ($locale instanceof LocaleData) {
return $locale->locale->value;
}

return $locale?->value ?? $locale;
}
}

0 comments on commit e9a62ae

Please sign in to comment.