aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/commerceguys/intl/src/Locale.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/commerceguys/intl/src/Locale.php')
-rw-r--r--vendor/commerceguys/intl/src/Locale.php43
1 files changed, 18 insertions, 25 deletions
diff --git a/vendor/commerceguys/intl/src/Locale.php b/vendor/commerceguys/intl/src/Locale.php
index c5c3c5ef5..9016f5bab 100644
--- a/vendor/commerceguys/intl/src/Locale.php
+++ b/vendor/commerceguys/intl/src/Locale.php
@@ -11,7 +11,7 @@ final class Locale
*
* @var array
*/
- protected static $aliases = [
+ protected static array $aliases = [
'az-AZ' => 'az-Latn-AZ',
'bs-BA' => 'bs-Latn-BA',
'ha-GH' => 'ha-Latn-GH',
@@ -62,7 +62,7 @@ final class Locale
*
* @var array
*/
- protected static $parents = [
+ protected static array $parents = [
'en-150' => 'en-001',
'en-AG' => 'en-001',
'en-AI' => 'en-001',
@@ -91,6 +91,7 @@ final class Locale
'en-GM' => 'en-001',
'en-GY' => 'en-001',
'en-HK' => 'en-001',
+ 'en-ID' => 'en-001',
'en-IE' => 'en-001',
'en-IL' => 'en-001',
'en-IM' => 'en-001',
@@ -169,6 +170,7 @@ final class Locale
'es-EC' => 'es-419',
'es-GT' => 'es-419',
'es-HN' => 'es-419',
+ 'es-JP' => 'es-419',
'es-MX' => 'es-419',
'es-NI' => 'es-419',
'es-PA' => 'es-419',
@@ -182,6 +184,7 @@ final class Locale
'ht' => 'fr-HT',
'nb' => 'no',
'nn' => 'no',
+ 'no-NO' => 'no',
'pt-AO' => 'pt-PT',
'pt-CH' => 'pt-PT',
'pt-CV' => 'pt-PT',
@@ -198,28 +201,26 @@ final class Locale
'bal-Latn' => 'und',
'blt-Latn' => 'und',
'bs-Cyrl' => 'und',
- 'byn-Latn' => 'und',
'en-Dsrt' => 'und',
'en-Shaw' => 'und',
'iu-Latn' => 'und',
'kk-Arab' => 'und',
'ks-Deva' => 'und',
'ku-Arab' => 'und',
+ 'kxv-Deva' => 'und',
+ 'kxv-Orya' => 'und',
+ 'kxv-Telu' => 'und',
'ky-Arab' => 'und',
'ky-Latn' => 'und',
- 'ml-Arab' => 'und',
'mn-Mong' => 'und',
'mni-Mtei' => 'und',
'ms-Arab' => 'und',
'pa-Arab' => 'und',
- 'sat-Deva' => 'und',
- 'sd-Deva' => 'und',
- 'sd-Khoj' => 'und',
- 'sd-Sind' => 'und',
'so-Arab' => 'und',
'sr-Latn' => 'und',
'sw-Arab' => 'und',
'tg-Arab' => 'und',
+ 'ug-Cyrl' => 'und',
'uz-Arab' => 'und',
'uz-Cyrl' => 'und',
'yue-Hans' => 'und',
@@ -235,12 +236,8 @@ final class Locale
*
* @return bool TRUE if the locales match, FALSE otherwise.
*/
- public static function match($firstLocale, $secondLocale)
+ public static function match(string $firstLocale, string $secondLocale): bool
{
- if (empty($firstLocale) || empty($secondLocale)) {
- return false;
- }
-
return self::canonicalize($firstLocale) === self::canonicalize($secondLocale);
}
@@ -257,12 +254,8 @@ final class Locale
*
* @return bool TRUE if there is a common candidate, FALSE otherwise.
*/
- public static function matchCandidates($firstLocale, $secondLocale)
+ public static function matchCandidates(string $firstLocale, string $secondLocale): bool
{
- if (empty($firstLocale) || empty($secondLocale)) {
- return false;
- }
-
$firstLocale = self::canonicalize($firstLocale);
$secondLocale = self::canonicalize($secondLocale);
$firstLocaleCandidates = self::getCandidates($firstLocale);
@@ -283,13 +276,13 @@ final class Locale
*
* @param array $availableLocales The available locales.
* @param string $locale The requested locale (i.e. fr-FR).
- * @param string $fallbackLocale A fallback locale (i.e "en").
+ * @param string|null $fallbackLocale A fallback locale (i.e "en").
*
* @return string
*
* @throws UnknownLocaleException
*/
- public static function resolve(array $availableLocales, $locale, $fallbackLocale = null)
+ public static function resolve(array $availableLocales, string $locale, string $fallbackLocale = null): string
{
$locale = self::canonicalize($locale);
$resolvedLocale = null;
@@ -317,7 +310,7 @@ final class Locale
*
* @return string The canonicalized locale.
*/
- public static function canonicalize($locale)
+ public static function canonicalize(string $locale): string
{
if (empty($locale)) {
return $locale;
@@ -356,11 +349,11 @@ final class Locale
* 2) sr
*
* @param string $locale The locale (i.e. fr-FR).
- * @param string $fallbackLocale A fallback locale (i.e "en").
+ * @param string|null $fallbackLocale A fallback locale (i.e "en").
*
* @return array An array of all variants of a locale.
*/
- public static function getCandidates($locale, $fallbackLocale = null)
+ public static function getCandidates(string $locale, string $fallbackLocale = null): array
{
$locale = self::replaceAlias($locale);
$candidates = [$locale];
@@ -388,7 +381,7 @@ final class Locale
* @return string|null
* The parent, or null if none found.
*/
- public static function getParent($locale)
+ public static function getParent(string $locale): ?string
{
$parent = null;
if (isset(self::$parents[$locale])) {
@@ -416,7 +409,7 @@ final class Locale
*
* @return string The locale.
*/
- public static function replaceAlias($locale)
+ public static function replaceAlias(string $locale): string
{
if (!empty($locale) && isset(self::$aliases[$locale])) {
$locale = self::$aliases[$locale];