diff --git a/src/Util/CountryLanguages.php b/src/Util/CountryLanguages.php index 9369de2..ee10df0 100644 --- a/src/Util/CountryLanguages.php +++ b/src/Util/CountryLanguages.php @@ -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; } }