@@ -2776,6 +2776,9 @@ public function formatOutOfCountryKeepingAlphaChars(PhoneNumber $number, $region
2776
2776
$ regionCode = $ this ->getRegionCodeForCountryCode ($ countryCode );
2777
2777
// Metadata cannot be null because the country calling code is valid.
2778
2778
$ metadataForRegion = $ this ->getMetadataForRegionOrCallingCode ($ countryCode , $ regionCode );
2779
+ // Strip any extension
2780
+ $ this ->maybeStripExtension ($ formattedNumber );
2781
+ // Append the formatted extension
2779
2782
$ this ->maybeAppendFormattedExtension (
2780
2783
$ number ,
2781
2784
$ metadataForRegion ,
@@ -3675,6 +3678,13 @@ public function isPossibleNumber($number, $regionDialingFrom = null)
3675
3678
* length (obviously includes the length of area codes for fixed line numbers), it will
3676
3679
* return false for the subscriber-number-only version.
3677
3680
* </ol>
3681
+ *
3682
+ * There is a known <a href="https://issuetracker.google.com/issues/335892662">issue</a> with this
3683
+ * method: if a number is possible only in a certain region among several regions that share the
3684
+ * same country calling code, this method will consider only the "main" region. For example,
3685
+ * +1310xxxx are valid numbers in Canada. However, they are not possible in the US. As a result,
3686
+ * this method will return IS_POSSIBLE_LOCAL_ONLY for +1310xxxx.
3687
+ *
3678
3688
* @param PhoneNumber $number the number that needs to be checked
3679
3689
* @return int a ValidationResult object which indicates whether the number is possible
3680
3690
*/
@@ -3705,6 +3715,12 @@ public function isPossibleNumberWithReason(PhoneNumber $number)
3705
3715
* return false for the subscriber-number-only version.
3706
3716
* </ol>
3707
3717
*
3718
+ * There is a known <a href="https://issuetracker.google.com/issues/335892662">issue</a> with this
3719
+ * method: if a number is possible only in a certain region among several regions that share the
3720
+ * same country calling code, this method will consider only the "main" region. For example,
3721
+ * +1310xxxx are valid numbers in Canada. However, they are not possible in the US. As a result,
3722
+ * this method will return IS_POSSIBLE_LOCAL_ONLY for +1310xxxx.
3723
+ *
3708
3724
* @param PhoneNumber $number the number that needs to be checked
3709
3725
* @param int $type the PhoneNumberType we are interested in
3710
3726
* @return int a ValidationResult object which indicates whether the number is possible
0 commit comments