patch: fixes missing null check
This commit is contained in:
@@ -38,7 +38,7 @@ class CountryLanguages
|
|||||||
'Filipino'
|
'Filipino'
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function fromCountryCode(string $countryCode): string
|
public static function fromCountryCode(string $countryCode): ?string
|
||||||
{
|
{
|
||||||
$countryLanguages = [
|
$countryLanguages = [
|
||||||
'US' => 'English (US)',
|
'US' => 'English (US)',
|
||||||
@@ -85,10 +85,10 @@ class CountryLanguages
|
|||||||
'KE' => 'English', // Also Swahili
|
'KE' => 'English', // Also Swahili
|
||||||
];
|
];
|
||||||
|
|
||||||
return $countryLanguages[$countryCode];
|
return $countryLanguages[$countryCode] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function fromCountryName(string $countryName): string
|
public static function fromCountryName(string $countryName): ?string
|
||||||
{
|
{
|
||||||
$countryLanguages = [
|
$countryLanguages = [
|
||||||
'United States' => 'English (US)',
|
'United States' => 'English (US)',
|
||||||
@@ -135,6 +135,6 @@ class CountryLanguages
|
|||||||
'Kenya' => 'English', // Also Swahili
|
'Kenya' => 'English', // Also Swahili
|
||||||
];
|
];
|
||||||
|
|
||||||
return $countryLanguages[$countryName];
|
return $countryLanguages[$countryName] ?? null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user