Skip to content

Commit

Permalink
Merge pull request #284 from giggsey/upstream-8.9.15
Browse files Browse the repository at this point in the history
 Upstream metadata changes from Google for v8.9.15
  • Loading branch information
giggsey committed Oct 4, 2018
2 parents 5cb9199 + a157a5f commit 3189ade
Show file tree
Hide file tree
Showing 49 changed files with 801 additions and 636 deletions.
2 changes: 1 addition & 1 deletion METADATA-VERSION.txt
Expand Up @@ -2,4 +2,4 @@
# It can be a commit, branch or tag of the https://github.com/googlei18n/libphonenumber project
#
# For more information, look at the phing tasks in build.xml
v8.9.14
v8.9.15
20 changes: 0 additions & 20 deletions src/PhoneNumberMatcher.php
Expand Up @@ -488,26 +488,6 @@ protected function parseAndVerify($candidate, $offset)

$number = $this->phoneUtil->parseAndKeepRawInput($candidate, $this->preferredRegion);

// Check Israel * numbers: these are a special case in that they are four-digit numbers that
// our library supports, but they can only be dialled with a leading *. Since we don't
// actually store or detect the * in our phone number library, this means in practice we
// detect most four digit numbers as being valid for Israel. We are considering moving these
// numbers to ShortNumberInfo instead, in which case this problem would go away, but in the
// meantime we want to restrict the false matches so we only allow these numbers if they are
// preceded by a star. We enforce this for all leniency levels even though these numbers are
// technically accepted by isPossibleNumber and isValidNumber since we consider it to be a
// deficiency in those methods that they accept these numbers without the *.
// TODO: Remove this or make it significantly less hacky once we've decided how to
// handle these short codes going forward in ShortNumberInfo. We could use the formatting
// rules for instance, but that would be slower.
if ($this->phoneUtil->getRegionCodeForCountryCode($number->getCountryCode()) == "IL"
&& mb_strlen($this->phoneUtil->getNationalSignificantNumber($number)) === 4
&& ($offset === 0 || ($offset > 0 && mb_substr($this->text, $offset - 1, 1) != '*'))
) {
// No match.
return null;
}

if ($this->leniency->verify($number, $candidate, $this->phoneUtil)) {
// We used parseAndKeepRawInput to create this number, but for now we don't return the extra
// values parsed. TODO: stop clearing all values here and switch all users over
Expand Down
6 changes: 3 additions & 3 deletions src/carrier/data/en/240.php
Expand Up @@ -11,7 +11,7 @@
*/

return array (
2405 => 'Orange GQ',
2406 => 'Orange GQ',
2407 => 'Orange GQ',
240222 => 'GETESA',
240550 => 'Muni',
240551 => 'HiTS',
);
2 changes: 1 addition & 1 deletion src/carrier/data/en/32.php
Expand Up @@ -12,7 +12,7 @@

return array (
32455 => 'VOO',
32456 => 'JIM Mobile',
32456 => 'Mobile Vikings/JIM Mobile',
32460 => 'Proximus',
324618 => 'N.M.B.S.',
324630 => 'TISMI BV',
Expand Down
4 changes: 2 additions & 2 deletions src/carrier/data/en/374.php
Expand Up @@ -15,8 +15,8 @@
37443 => 'Beeline',
37444 => 'Ucom',
37449 => 'VivaCell-MTS',
37455 => 'Ucom',
37477 => 'VivaCell-MTS',
3745 => 'Ucom',
3747 => 'VivaCell-MTS',
37488 => 'VivaCell-MTS',
37491 => 'Beeline',
37493 => 'VivaCell-MTS',
Expand Down
4 changes: 1 addition & 3 deletions src/carrier/data/en/84.php
Expand Up @@ -36,9 +36,7 @@
8483 => 'Vinaphone',
8484 => 'Vinaphone',
8485 => 'Vinaphone',
84866 => 'Viettel Mobile',
84868 => 'Viettel Mobile',
84869 => 'Viettel Mobile',
8486 => 'Viettel Mobile',
8488 => 'Vinaphone',
8489 => 'MobiFone',
8490 => 'MobiFone',
Expand Down
5 changes: 2 additions & 3 deletions src/carrier/data/en/994.php
Expand Up @@ -17,7 +17,6 @@
99450 => 'Azercell',
99451 => 'Azercell',
99455 => 'Bakcell',
99460 => 'Nakhtel',
99470 => 'Nar Mobile',
99477 => 'Nar Mobile',
9946 => 'Nakhtel',
9947 => 'Nar Mobile',
);
4 changes: 2 additions & 2 deletions src/carrier/data/ru/374.php
Expand Up @@ -15,8 +15,8 @@
37443 => 'Билайн',
37444 => 'Юком',
37449 => 'ВиваСелл-МТС',
37455 => 'Юком',
37477 => 'ВиваСелл-МТС',
3745 => 'Юком',
3747 => 'ВиваСелл-МТС',
37488 => 'ВиваСелл-МТС',
37491 => 'Билайн',
37493 => 'ВиваСелл-МТС',
Expand Down
26 changes: 13 additions & 13 deletions src/data/PhoneNumberMetadata_AE.php
Expand Up @@ -162,49 +162,49 @@
array (
0 =>
array (
'pattern' => '([2-4679])(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
'pattern' => '(\\d{3})(\\d{2,9})',
'format' => '$1 $2',
'leadingDigitsPatterns' =>
array (
0 => '[2-4679][2-8]',
0 => '60|8',
),
'nationalPrefixFormattingRule' => '0$1',
'nationalPrefixFormattingRule' => '',
'domesticCarrierCodeFormattingRule' => '',
'nationalPrefixOptionalWhenFormatting' => false,
),
1 =>
array (
'pattern' => '(5\\d)(\\d{3})(\\d{4})',
'pattern' => '(\\d)(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '5',
0 => '[236]|[479][2-8]',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
'nationalPrefixOptionalWhenFormatting' => false,
),
2 =>
array (
'pattern' => '([479]00)(\\d)(\\d{5})',
'pattern' => '(\\d{2})(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '[479]00',
0 => '5',
),
'nationalPrefixFormattingRule' => '$1',
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
'nationalPrefixOptionalWhenFormatting' => false,
),
3 =>
array (
'pattern' => '([68]00)(\\d{2,9})',
'format' => '$1 $2',
'pattern' => '(\\d{3})(\\d)(\\d{5})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '[68]00',
0 => '[479]',
),
'nationalPrefixFormattingRule' => '$1',
'nationalPrefixFormattingRule' => '',
'domesticCarrierCodeFormattingRule' => '',
'nationalPrefixOptionalWhenFormatting' => false,
),
Expand Down
25 changes: 24 additions & 1 deletion src/data/PhoneNumberMetadata_AF.php
Expand Up @@ -147,7 +147,18 @@
array (
0 =>
array (
'pattern' => '([2-7]\\d)(\\d{3})(\\d{4})',
'pattern' => '(\\d{3})(\\d{4})',
'format' => '$1 $2',
'leadingDigitsPatterns' =>
array (
),
'nationalPrefixFormattingRule' => '',
'domesticCarrierCodeFormattingRule' => '',
'nationalPrefixOptionalWhenFormatting' => false,
),
1 =>
array (
'pattern' => '(\\d{2})(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
Expand All @@ -160,6 +171,18 @@
),
'intlNumberFormat' =>
array (
0 =>
array (
'pattern' => '(\\d{2})(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '[2-7]',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
'nationalPrefixOptionalWhenFormatting' => false,
),
),
'mainCountryForCode' => false,
'leadingZeroPossible' => false,
Expand Down
34 changes: 23 additions & 11 deletions src/data/PhoneNumberMetadata_AL.php
Expand Up @@ -29,7 +29,7 @@
),
'fixedLine' =>
array (
'NationalNumberPattern' => '(?:[2358](?:[16-9]\\d[2-9]|[2-5][2-9]\\d)|4(?:[2-57-9][2-9]\\d|6\\d{2}))\\d{4}',
'NationalNumberPattern' => '(?:[2358](?:[16-9]\\d[2-9]|[2-5][2-9]\\d)|4(?:[2-57-9][2-9]|6\\d)\\d)\\d{4}',
'ExampleNumber' => '22345678',
'PossibleLength' =>
array (
Expand Down Expand Up @@ -68,7 +68,7 @@
),
'premiumRate' =>
array (
'NationalNumberPattern' => '900[1-9]\\d{2}',
'NationalNumberPattern' => '900[1-9]\\d\\d',
'ExampleNumber' => '900123',
'PossibleLength' =>
array (
Expand All @@ -80,7 +80,7 @@
),
'sharedCost' =>
array (
'NationalNumberPattern' => '808[1-9]\\d{2}',
'NationalNumberPattern' => '808[1-9]\\d\\d',
'ExampleNumber' => '808123',
'PossibleLength' =>
array (
Expand Down Expand Up @@ -162,23 +162,23 @@
array (
0 =>
array (
'pattern' => '(4)(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
'pattern' => '(\\d{3})(\\d{3,4})',
'format' => '$1 $2',
'leadingDigitsPatterns' =>
array (
0 => '4[0-6]',
0 => '80|9',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
'nationalPrefixOptionalWhenFormatting' => false,
),
1 =>
array (
'pattern' => '(6\\d)(\\d{3})(\\d{4})',
'pattern' => '(\\d)(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '6',
0 => '4[2-6]',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
Expand All @@ -190,19 +190,31 @@
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '[2358][2-5]|4[7-9]',
0 => '[2358][2-5]|4',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
'nationalPrefixOptionalWhenFormatting' => false,
),
3 =>
array (
'pattern' => '(\\d{3})(\\d{3,5})',
'pattern' => '(\\d{3})(\\d{5})',
'format' => '$1 $2',
'leadingDigitsPatterns' =>
array (
0 => '[235][16-9]|[79]|8[016-9]',
0 => '[23578]',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
'nationalPrefixOptionalWhenFormatting' => false,
),
4 =>
array (
'pattern' => '(\\d{2})(\\d{3})(\\d{4})',
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '6',
),
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
Expand Down
16 changes: 8 additions & 8 deletions src/data/PhoneNumberMetadata_AM.php
Expand Up @@ -27,7 +27,7 @@
),
'fixedLine' =>
array (
'NationalNumberPattern' => '(?:1[0-2]\\d|2(?:2[2-46]|3[1-8]|4[2-69]|5[2-7]|6[1-9]|8[1-7])|3[12]2|47\\d)\\d{5}',
'NationalNumberPattern' => '(?:(?:1[0-2]|47)\\d|2(?:2[2-46]|3[1-8]|4[2-69]|5[2-7]|6[1-9]|8[1-7])|3[12]2)\\d{5}',
'ExampleNumber' => '10123456',
'PossibleLength' =>
array (
Expand Down Expand Up @@ -165,25 +165,25 @@
),
1 =>
array (
'pattern' => '(\\d{2})(\\d{6})',
'pattern' => '(\\d{3})(\\d{5})',
'format' => '$1 $2',
'leadingDigitsPatterns' =>
array (
0 => '4[1349]|[5-7]|88|9[1-9]',
0 => '[23]',
),
'nationalPrefixFormattingRule' => '0$1',
'nationalPrefixFormattingRule' => '(0$1)',
'domesticCarrierCodeFormattingRule' => '',
'nationalPrefixOptionalWhenFormatting' => false,
),
2 =>
array (
'pattern' => '(\\d{3})(\\d{5})',
'pattern' => '(\\d{2})(\\d{6})',
'format' => '$1 $2',
'leadingDigitsPatterns' =>
array (
0 => '[23]',
0 => '[4-7]|88|9[13-9]',
),
'nationalPrefixFormattingRule' => '(0$1)',
'nationalPrefixFormattingRule' => '0$1',
'domesticCarrierCodeFormattingRule' => '',
'nationalPrefixOptionalWhenFormatting' => false,
),
Expand All @@ -193,7 +193,7 @@
'format' => '$1 $2 $3',
'leadingDigitsPatterns' =>
array (
0 => '8|90',
0 => '[89]',
),
'nationalPrefixFormattingRule' => '0 $1',
'domesticCarrierCodeFormattingRule' => '',
Expand Down

0 comments on commit 3189ade

Please sign in to comment.