From 3b65044980bf5320b9b010128fcd3f7871a8f258 Mon Sep 17 00:00:00 2001 From: Joshua Gigg Date: Wed, 15 Jan 2025 17:00:50 +0000 Subject: [PATCH] Document the issue with checking isPossible only for default country See https://issuetracker.google.com/issues/335892662 for details Mirrors https://github.com/google/libphonenumber/pull/3771 --- src/PhoneNumberUtil.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/PhoneNumberUtil.php b/src/PhoneNumberUtil.php index 76349948..e87b6cde 100644 --- a/src/PhoneNumberUtil.php +++ b/src/PhoneNumberUtil.php @@ -3678,6 +3678,13 @@ public function isPossibleNumber($number, $regionDialingFrom = null) * length (obviously includes the length of area codes for fixed line numbers), it will * return false for the subscriber-number-only version. * + * + * There is a known issue with this + * method: if a number is possible only in a certain region among several regions that share the + * same country calling code, this method will consider only the "main" region. For example, + * +1310xxxx are valid numbers in Canada. However, they are not possible in the US. As a result, + * this method will return IS_POSSIBLE_LOCAL_ONLY for +1310xxxx. + * * @param PhoneNumber $number the number that needs to be checked * @return int a ValidationResult object which indicates whether the number is possible */ @@ -3708,6 +3715,12 @@ public function isPossibleNumberWithReason(PhoneNumber $number) * return false for the subscriber-number-only version. * * + * There is a known issue with this + * method: if a number is possible only in a certain region among several regions that share the + * same country calling code, this method will consider only the "main" region. For example, + * +1310xxxx are valid numbers in Canada. However, they are not possible in the US. As a result, + * this method will return IS_POSSIBLE_LOCAL_ONLY for +1310xxxx. + * * @param PhoneNumber $number the number that needs to be checked * @param int $type the PhoneNumberType we are interested in * @return int a ValidationResult object which indicates whether the number is possible