From d3176baff2e4921030c8fbd7a14b1133b5cadbef Mon Sep 17 00:00:00 2001 From: Brock H Caldwell Date: Thu, 1 May 2025 22:35:54 -0500 Subject: [PATCH] patch: fixes missing null check --- src/Util/CountryLanguages.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; } }