patch: fixes missing null check

This commit is contained in:
2025-05-01 22:35:54 -05:00
parent cc77cccf0b
commit d3176baff2

View File

@@ -38,7 +38,7 @@ class CountryLanguages
'Filipino'
];
public static function fromCountryCode(string $countryCode): string
public static function fromCountryCode(string $countryCode): ?string
{
$countryLanguages = [
'US' => 'English (US)',
@@ -85,10 +85,10 @@ class CountryLanguages
'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 = [
'United States' => 'English (US)',
@@ -135,6 +135,6 @@ class CountryLanguages
'Kenya' => 'English', // Also Swahili
];
return $countryLanguages[$countryName];
return $countryLanguages[$countryName] ?? null;
}
}