Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream metadata changes from Google for v8.13.18 #589

Merged
merged 3 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion METADATA-VERSION.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# It can be a commit, branch or tag of the https://github.com/google/libphonenumber project
#
# For more information, look at the phing tasks in build.xml
v8.13.17
v8.13.18
18 changes: 9 additions & 9 deletions src/AsYouTypeFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* An AsYouTypeFormatter instance can be created by invoking PhoneNumberUtil::getAsYouTypeFormatter().
* After that, digits can be added by invoking inputDigit() on the formatter instance, and the partially
* formatted phone number will be returned each time a digit is added. clear() can be invokved before
* formatted phone number will be returned each time a digit is added. clear() can be invoked before
* formatting a new number.
*/
class AsYouTypeFormatter
Expand Down Expand Up @@ -138,7 +138,7 @@ class AsYouTypeFormatter
* calling code, from the national number.
* @var string
*/
private static $seperatorBeforeNationalNumber = ' ';
private static $separatorBeforeNationalNumber = ' ';
/**
* @var PhoneMetadata
*/
Expand Down Expand Up @@ -221,7 +221,7 @@ private function getMetadataForRegion($regionCode)
if ($metadata !== null) {
return $metadata;
}
// Set to a default instance of teh metadata. This allows us to function with an incorrect
// Set to a default instance of the metadata. This allows us to function with an incorrect
// region code, even if the formatting only works for numbers specified with "+".
return self::$emptyMetadata;
}
Expand Down Expand Up @@ -463,7 +463,7 @@ private function inputDigitWithOptionToRememberPosition($nextChar, $rememberPosi
// Add an additional space to separate long NDD and national significant number for
// readability. We don't set shouldAddSpaceAfterNationalPrefix to true, since we don't want
// this to change later when we choose formatting templates.
$this->prefixBeforeNationalNumber .= self::$seperatorBeforeNationalNumber;
$this->prefixBeforeNationalNumber .= self::$separatorBeforeNationalNumber;
return $this->attemptToChoosePatternWithPrefixExtracted();
}
return $this->accruedInput;
Expand Down Expand Up @@ -639,12 +639,12 @@ private function appendNationalNumber($nationalNumber)
$prefixBeforeNationalNumberLength = \mb_strlen($this->prefixBeforeNationalNumber);
if ($this->shouldAddSpaceAfterNationalPrefix && $prefixBeforeNationalNumberLength > 0
&& \mb_substr($this->prefixBeforeNationalNumber, $prefixBeforeNationalNumberLength - 1, 1)
!= self::$seperatorBeforeNationalNumber
!= self::$separatorBeforeNationalNumber
) {
// We want to add a space after the national prefix if the national prefix formatting rule
// indicates that this would normally be done, with the exception of the case where we already
// appended a space because the NDD was surprisingly long.
return $this->prefixBeforeNationalNumber . self::$seperatorBeforeNationalNumber . $nationalNumber;
return $this->prefixBeforeNationalNumber . self::$separatorBeforeNationalNumber . $nationalNumber;
}

return $this->prefixBeforeNationalNumber . $nationalNumber;
Expand Down Expand Up @@ -715,7 +715,7 @@ private function removeNationalPrefixFromNationalNumber()
$startOfNationalNumber = 0;
if ($this->isNanpaNumberWithNationalPrefix()) {
$startOfNationalNumber = 1;
$this->prefixBeforeNationalNumber .= '1' . self::$seperatorBeforeNationalNumber;
$this->prefixBeforeNationalNumber .= '1' . self::$separatorBeforeNationalNumber;
$this->isCompleteNumber = true;
} elseif ($this->currentMetadata->hasNationalPrefixForParsing()) {
$m = new Matcher($this->currentMetadata->getNationalPrefixForParsing(), $this->nationalNumber);
Expand Down Expand Up @@ -752,7 +752,7 @@ private function attemptToExtractIdd()
$this->nationalNumber = \mb_substr($this->accruedInputWithoutFormatting, $startOfCountryCallingCode);
$this->prefixBeforeNationalNumber = \mb_substr($this->accruedInputWithoutFormatting, 0, $startOfCountryCallingCode);
if (\mb_substr($this->accruedInputWithoutFormatting, 0, 1) != PhoneNumberUtil::PLUS_SIGN) {
$this->prefixBeforeNationalNumber .= self::$seperatorBeforeNationalNumber;
$this->prefixBeforeNationalNumber .= self::$separatorBeforeNationalNumber;
}
return true;
}
Expand Down Expand Up @@ -783,7 +783,7 @@ private function attemptToExtractCountryCallingCode()
$this->currentMetadata = $this->getMetadataForRegion($newRegionCode);
}
$countryCodeString = (string)$countryCode;
$this->prefixBeforeNationalNumber .= $countryCodeString . self::$seperatorBeforeNationalNumber;
$this->prefixBeforeNationalNumber .= $countryCodeString . self::$separatorBeforeNationalNumber;
// When we have successfully extracted the IDD, the previously extracted NDD should be cleared
// because it is no longer valid.
$this->extractedNationalPrefix = '';
Expand Down
4 changes: 2 additions & 2 deletions src/PhoneNumberUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -1236,10 +1236,10 @@ public function getLengthOfNationalDestinationCode(PhoneNumber $number)
public function format(PhoneNumber $number, $numberFormat)
{
if ($number->getNationalNumber() == 0 && $number->hasRawInput()) {
// Unparseable numbers that kept their raw input just use that.
// Unparsable numbers that kept their raw input just use that.
// This is the only case where a number can be formatted as E164 without a
// leading '+' symbol (but the original number wasn't parseable anyway).
// TODO: Consider removing the 'if' above so that unparseable
// TODO: Consider removing the 'if' above so that unparsable
// strings without raw input format to the empty string instead of "+00"
$rawInput = $number->getRawInput();
if ($rawInput !== '') {
Expand Down
2 changes: 1 addition & 1 deletion src/ShortNumberInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static function resetInstance()
}

/**
* Returns a list with teh region codes that match the specific country calling code. For
* Returns a list with the region codes that match the specific country calling code. For
* non-geographical country calling codes, the region code 001 is returned. Also, in the case
* of no region code being found, an empty list is returned.
*
Expand Down
2 changes: 1 addition & 1 deletion src/carrier/data/en/221.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
22172 => 'HAYO',
22175 => 'Promobile',
221757 => 'Origines',
22176 => 'Tigo',
22176 => 'Free',
22177 => 'Orange',
22178 => 'Orange',
22179 => 'ADIE',
Expand Down
7 changes: 7 additions & 0 deletions src/carrier/data/en/41.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
417840 => 'UPC Switzerland',
417841 => 'UPC Switzerland',
417842 => 'UPC Switzerland',
4178470 => 'MTEL',
4178471 => 'MTEL',
4178472 => 'MTEL',
4178473 => 'MTEL',
4178474 => 'MTEL',
4178475 => 'MTEL',
4178476 => 'MTEL',
4178480 => 'Nexphone',
4178490 => 'Telecom26 AG',
41785 => 'Salt',
Expand Down
6 changes: 6 additions & 0 deletions src/carrier/data/en/46.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
46720894 => 'TeliaSonera',
46720895 => 'TeliaSonera',
46720896 => 'TeliaSonera',
46720898 => 'Xplora',
46720902 => 'Telavox AB',
46720908 => 'Telavox AB',
4672092 => 'Telavox AB',
Expand Down Expand Up @@ -212,6 +213,11 @@
4672342 => 'Telenor Sverige',
4672343 => 'MESSAGEBIRD B.V.',
46723440 => 'Beepsend',
46723442 => 'Xplora',
46723443 => 'Xplora',
46723445 => 'Xplora',
46723446 => 'Xplora',
46723447 => 'Xplora',
46723449 => 'Beepsend',
4672345 => '42 Telecom AB',
46723460 => 'Beepsend',
Expand Down
1 change: 1 addition & 0 deletions src/carrier/data/en/53.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@

return array (
535 => 'etecsa',
536 => 'etecsa',
);
8 changes: 8 additions & 0 deletions src/carrier/data/en/64.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
64206 => 'Voyager Internet Limted',
6421 => 'Vodafone',
6422 => '2degrees',
64260 => '2degrees',
64261 => 'Spark',
64262 => 'Spark',
64263 => 'Spark',
64264 => 'Spark',
64266 => '2degrees',
64268 => 'Spark',
64269 => 'Spark',
6427 => 'Spark',
64280 => 'Vodafone',
64281 => 'Sure (Guernsey) New Zealand Limited',
Expand Down
5 changes: 4 additions & 1 deletion src/carrier/data/en/65.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
658059 => 'M1',
65806 => 'Simba',
658067 => 'SingTel',
65807 => 'SingTel',
65807 => 'Simba',
658070 => 'SingTel',
658071 => 'SingTel',
65808 => 'Simba',
6581 => 'StarHub',
65810 => 'M1',
65812 => 'SingTel',
Expand Down
1 change: 1 addition & 0 deletions src/carrier/data/en/972.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
97255440 => 'Merkaziya',
9725550 => 'Annatel',
9725551 => 'Annatel',
9725552 => 'Annatel',
9725555 => 'Rami Levy',
972556 => 'Rami Levy',
9725570 => 'Cellact',
Expand Down
3 changes: 3 additions & 0 deletions src/carrier/data/en/973.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

return array (
97330 => 'Telecommunications Regulatory Authority',
97331 => 'Royal Court',
97332 => 'Batelco',
97333 => 'VIVA',
Expand All @@ -19,8 +20,10 @@
97336 => 'zain BH',
97337 => 'zain BH',
97338 => 'Batelco',
973385 => 'Telecommunications Regulatory Authority',
97339 => 'Batelco',
97363 => 'VIVA',
97364 => 'Batelco',
9736630 => 'zain BH',
9736633 => 'zain BH',
9736634 => 'zain BH',
Expand Down
7 changes: 1 addition & 6 deletions src/carrier/data/en/995.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@
*/

return array (
9955000 => 'Silknet',
9955004 => 'Silknet',
995500 => 'Silknet',
99550050 => 'MagtiCom',
99550055 => 'Silknet',
99550070 => 'MyPhone',
99550077 => 'Silknet',
9955008 => 'Silknet',
9955009 => 'Silknet',
9955050 => 'Silknet',
9955055 => 'MagtiCom',
995510 => 'Silknet',
Expand Down
1 change: 1 addition & 0 deletions src/carrier/data/en/998.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

return array (
9982 => 'Beeline',
9983 => 'HUMANS',
99850 => 'Ucell',
99861220 => 'MobiUZ',
Expand Down
2 changes: 1 addition & 1 deletion src/data/PhoneNumberAlternateFormats_84.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '[69]',
0 => '6',
),
'nationalPrefixFormattingRule' => '',
'domesticCarrierCodeFormattingRule' => '',
Expand Down
10 changes: 5 additions & 5 deletions src/data/PhoneNumberMetadata_BH.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
),
'fixedLine' =>
array (
'NationalNumberPattern' => '(?:1(?:3[1356]|6[0156]|7\\d)\\d|6(?:1[16]\\d|500|6(?:0\\d|3[12]|44|7[7-9]|88)|9[69][69])|7(?:1(?:11|78)|7\\d\\d))\\d{4}',
'NationalNumberPattern' => '(?:1(?:3[1356]|6[0156]|7\\d)\\d|6(?:1[16]\\d|500|6(?:0\\d|3[12]|44|7[7-9]|88)|9[69][69])|7(?:[07]\\d\\d|1(?:11|78)))\\d{4}',
'ExampleNumber' => '17001234',
'PossibleLength' =>
array (
Expand All @@ -36,7 +36,7 @@
),
'mobile' =>
array (
'NationalNumberPattern' => '(?:3(?:[1-79]\\d|8[0-47-9])\\d|6(?:3(?:00|33|6[16])|6(?:3[03-9]|[69]\\d|7[0-6])))\\d{4}',
'NationalNumberPattern' => '(?:3(?:[0-79]\\d|8[0-57-9])\\d|6(?:3(?:00|33|6[16])|441|6(?:3[03-9]|[69]\\d|7[0-6])))\\d{4}',
'ExampleNumber' => '36001234',
'PossibleLength' =>
array (
Expand All @@ -47,7 +47,7 @@
),
'tollFree' =>
array (
'NationalNumberPattern' => '80\\d{6}',
'NationalNumberPattern' => '8[02369]\\d{6}',
'ExampleNumber' => '80123456',
'PossibleLength' =>
array (
Expand All @@ -58,7 +58,7 @@
),
'premiumRate' =>
array (
'NationalNumberPattern' => '(?:87|9[014578])\\d{6}',
'NationalNumberPattern' => '(?:87|9[0-8])\\d{6}',
'ExampleNumber' => '90123456',
'PossibleLength' =>
array (
Expand Down Expand Up @@ -150,7 +150,7 @@
'format' => '$1 $2',
'leadingDigitsPatterns' =>
array (
0 => '[13679]|8[047]',
0 => '[13679]|8[02-4679]',
),
'nationalPrefixFormattingRule' => '',
'domesticCarrierCodeFormattingRule' => '',
Expand Down
6 changes: 3 additions & 3 deletions src/data/PhoneNumberMetadata_CU.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
return array (
'generalDesc' =>
array (
'NationalNumberPattern' => '[27]\\d{6,7}|[34]\\d{5,7}|(?:5|8\\d\\d)\\d{7}',
'NationalNumberPattern' => '[27]\\d{6,7}|[34]\\d{5,7}|63\\d{6}|(?:5|8\\d\\d)\\d{7}',
'PossibleLength' =>
array (
0 => 6,
Expand Down Expand Up @@ -43,7 +43,7 @@
),
'mobile' =>
array (
'NationalNumberPattern' => '5\\d{7}',
'NationalNumberPattern' => '(?:5\\d|63)\\d{6}',
'ExampleNumber' => '51234567',
'PossibleLength' =>
array (
Expand Down Expand Up @@ -185,7 +185,7 @@
'format' => '$1 $2',
'leadingDigitsPatterns' =>
array (
0 => '5',
0 => '[56]',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
Expand Down
14 changes: 13 additions & 1 deletion src/data/PhoneNumberMetadata_EG.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,19 @@
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '[189]',
0 => '[89]',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
'nationalPrefixOptionalWhenFormatting' => false,
),
3 =>
array (
'pattern' => '(\\d{2})(\\d{8})',
'format' => '$1 $2',
'leadingDigitsPatterns' =>
array (
0 => '1',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
Expand Down
2 changes: 1 addition & 1 deletion src/data/PhoneNumberMetadata_GE.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
),
'mobile' =>
array (
'NationalNumberPattern' => '5(?:(?:(?:0555|1(?:[17]77|555))[5-9]|757(?:7[7-9]|8[01]))\\d|22252[0-4])\\d\\d|(?:5(?:00(?:0\\d|44|5[05]|77|88|99)|1(?:1(?:00|[124]\\d|3[01])|4\\d\\d)|(?:44|68)\\d\\d|5(?:[0157-9]\\d\\d|200)|7(?:[0147-9]\\d\\d|5(?:00|[57]5))|8(?:0(?:[01]\\d|2[0-4])|58[89]|8(?:55|88))|9(?:090|[1-35-9]\\d\\d))|790\\d\\d)\\d{4}|5(?:0(?:070|505)|1(?:0[01]0|1(?:07|33|51))|2(?:0[02]0|2[25]2)|3(?:0[03]0|3[35]3)|(?:40[04]|900)0|5222)[0-4]\\d{3}',
'NationalNumberPattern' => '5(?:(?:(?:0555|1(?:[17]77|555))[5-9]|757(?:7[7-9]|8[01]))\\d|22252[0-4])\\d\\d|(?:5(?:00(?:0\\d|11|22|33|44|5[05]|77|88|99)|1(?:1(?:00|[124]\\d|3[01])|4\\d\\d)|(?:44|68)\\d\\d|5(?:[0157-9]\\d\\d|200)|7(?:[0147-9]\\d\\d|5(?:00|[57]5))|8(?:0(?:[01]\\d|2[0-4])|58[89]|8(?:55|88))|9(?:090|[1-35-9]\\d\\d))|790\\d\\d)\\d{4}|5(?:0(?:070|505)|1(?:0[01]0|1(?:07|33|51))|2(?:0[02]0|2[25]2)|3(?:0[03]0|3[35]3)|(?:40[04]|900)0|5222)[0-4]\\d{3}',
'ExampleNumber' => '555123456',
'PossibleLength' =>
array (
Expand Down
2 changes: 1 addition & 1 deletion src/data/PhoneNumberMetadata_GL.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
),
'fixedLine' =>
array (
'NationalNumberPattern' => '(?:19|3[1-7]|6[14689]|70|8[14-79]|9\\d)\\d{4}',
'NationalNumberPattern' => '(?:19|3[1-7]|[68][1-9]|70|9\\d)\\d{4}',
'ExampleNumber' => '321000',
'PossibleLength' =>
array (
Expand Down
2 changes: 1 addition & 1 deletion src/data/PhoneNumberMetadata_IL.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
),
'mobile' =>
array (
'NationalNumberPattern' => '55410\\d{4}|5(?:(?:[02368]\\d|[19][2-9]|4[1-9])\\d|5(?:01|1[79]|2[2-9]|3[0-3]|4[34]|5[015689]|6[6-8]|7[0-267]|8[7-9]|9[1-9]))\\d{5}',
'NationalNumberPattern' => '55410\\d{4}|5(?:(?:[02368]\\d|[19][2-9]|4[1-9])\\d|5(?:01|1[79]|2[2-9]|3[0-3]|4[34]|5[0-25689]|6[6-8]|7[0-267]|8[7-9]|9[1-9]))\\d{5}',
'ExampleNumber' => '502345678',
'PossibleLength' =>
array (
Expand Down
Loading
Loading