Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/4.1' into 14.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vudaltsov committed Oct 8, 2018
2 parents bd24bd2 + 793437f commit 6ec3640
Show file tree
Hide file tree
Showing 109 changed files with 23 additions and 264 deletions.
12 changes: 2 additions & 10 deletions Data/Bundle/Compiler/GenrbCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ public function __construct(string $genrb = 'genrb', string $envVars = '')
exec('which '.$genrb, $output, $status);

if (0 !== $status) {
throw new RuntimeException(sprintf(
'The command "%s" is not installed',
$genrb
));
throw new RuntimeException(sprintf('The command "%s" is not installed', $genrb));
}

$this->genrb = ($envVars ? $envVars.' ' : '').$genrb;
Expand All @@ -58,12 +55,7 @@ public function compile($sourcePath, $targetDir)
exec($this->genrb.' --quiet -e UTF-8 -d '.$targetDir.' '.$sourcePath, $output, $status);

if (0 !== $status) {
throw new RuntimeException(sprintf(
'genrb failed with status %d while compiling %s to %s.',
$status,
$sourcePath,
$targetDir
));
throw new RuntimeException(sprintf('genrb failed with status %d while compiling %s to %s.', $status, $sourcePath, $targetDir));
}
}
}
6 changes: 1 addition & 5 deletions Data/Bundle/Reader/IntlBundleReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ public function read($path, $locale)
// The bundle is NULL if the path does not look like a resource bundle
// (i.e. contain a bunch of *.res files)
if (null === $bundle) {
throw new ResourceBundleNotFoundException(sprintf(
'The resource bundle "%s/%s.res" could not be found.',
$path,
$locale
));
throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s/%s.res" could not be found.', $path, $locale));
}

// Other possible errors are U_USING_FALLBACK_WARNING and U_ZERO_ERROR,
Expand Down
16 changes: 3 additions & 13 deletions Data/Bundle/Reader/JsonBundleReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,17 @@ public function read($path, $locale)
}

if (!file_exists($fileName)) {
throw new ResourceBundleNotFoundException(sprintf(
'The resource bundle "%s" does not exist.',
$fileName
));
throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s" does not exist.', $fileName));
}

if (!is_file($fileName)) {
throw new RuntimeException(sprintf(
'The resource bundle "%s" is not a file.',
$fileName
));
throw new RuntimeException(sprintf('The resource bundle "%s" is not a file.', $fileName));
}

$data = json_decode(file_get_contents($fileName), true);

if (null === $data) {
throw new RuntimeException(sprintf(
'The resource bundle "%s" contains invalid JSON: %s',
$fileName,
json_last_error_msg()
));
throw new RuntimeException(sprintf('The resource bundle "%s" contains invalid JSON: %s', $fileName, json_last_error_msg()));
}

return $data;
Expand Down
12 changes: 2 additions & 10 deletions Data/Bundle/Reader/PhpBundleReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,11 @@ public function read($path, $locale)
}

if (!file_exists($fileName)) {
throw new ResourceBundleNotFoundException(sprintf(
'The resource bundle "%s/%s.php" does not exist.',
$path,
$locale
));
throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s/%s.php" does not exist.', $path, $locale));
}

if (!is_file($fileName)) {
throw new RuntimeException(sprintf(
'The resource bundle "%s/%s.php" is not a file.',
$path,
$locale
));
throw new RuntimeException(sprintf('The resource bundle "%s/%s.php" is not a file.', $path, $locale));
}

return include $fileName;
Expand Down
19 changes: 3 additions & 16 deletions Data/Generator/LanguageDataGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,32 +173,19 @@ private function generateAlpha2ToAlpha3Mapping(ArrayAccessibleResourceBundle $me
if (isset(self::$preferredAlpha2ToAlpha3Mapping[$language])) {
// Validate to prevent typos
if (!isset($aliases[self::$preferredAlpha2ToAlpha3Mapping[$language]])) {
throw new RuntimeException(
'The statically set three-letter mapping '.
self::$preferredAlpha2ToAlpha3Mapping[$language].' '.
'for the language code '.$language.' seems to be '.
'invalid. Typo?'
);
throw new RuntimeException('The statically set three-letter mapping '.self::$preferredAlpha2ToAlpha3Mapping[$language].' for the language code '.$language.' seems to be invalid. Typo?');
}

$alpha3 = self::$preferredAlpha2ToAlpha3Mapping[$language];
$alpha2 = $aliases[$alpha3]['replacement'];

if ($language !== $alpha2) {
throw new RuntimeException(
'The statically set three-letter mapping '.$alpha3.' '.
'for the language code '.$language.' seems to be '.
'an alias for '.$alpha2.'. Wrong mapping?'
);
throw new RuntimeException('The statically set three-letter mapping '.$alpha3.' for the language code '.$language.' seems to be an alias for '.$alpha2.'. Wrong mapping?');
}

$alpha2ToAlpha3[$language] = $alpha3;
} elseif (isset($alpha2ToAlpha3[$language])) {
throw new RuntimeException(
'Multiple three-letter mappings exist for the language '.
'code '.$language.'. Please add one of them to the '.
'property $preferredAlpha2ToAlpha3Mapping.'
);
throw new RuntimeException('Multiple three-letter mappings exist for the language code '.$language.'. Please add one of them to the property $preferredAlpha2ToAlpha3Mapping.');
} else {
$alpha2ToAlpha3[$language] = $alias;
}
Expand Down
4 changes: 4 additions & 0 deletions Data/Generator/RegionDataGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class RegionDataGenerator extends AbstractDataGenerator
const BOUVET_ISLAND_ID = 'BV';
const HEARD_MCDONALD_ISLANDS_ID = 'HM';
const CLIPPERTON_ISLAND_ID = 'CP';
const EUROZONE_ID = 'EZ';
const UNITED_NATIONS_ID = 'UN';

/**
* Regions excluded from generation.
Expand All @@ -43,6 +45,8 @@ class RegionDataGenerator extends AbstractDataGenerator
// Look like countries, but are sub-continents
self::OUTLYING_OCEANIA_REGION_ID => true,
self::EUROPEAN_UNION_ID => true,
self::EUROZONE_ID => true,
self::UNITED_NATIONS_ID => true,
// No longer exists
self::NETHERLANDS_ANTILLES_ID => true,
// Uninhabited islands
Expand Down
5 changes: 1 addition & 4 deletions Data/Util/RecursiveArrayAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ public static function get($array, array $indices)
}
}

throw new OutOfBoundsException(sprintf(
'The index %s does not exist.',
$index
));
throw new OutOfBoundsException(sprintf('The index %s does not exist.', $index));
}

return $array;
Expand Down
5 changes: 1 addition & 4 deletions Data/Util/RingBuffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ public function offsetExists($key)
public function offsetGet($key)
{
if (!isset($this->indices[$key])) {
throw new OutOfBoundsException(sprintf(
'The index "%s" does not exist.',
$key
));
throw new OutOfBoundsException(sprintf('The index "%s" does not exist.', $key));
}

return $this->values[$this->indices[$key]];
Expand Down
5 changes: 1 addition & 4 deletions DateFormatter/DateFormat/TimezoneTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ public static function getEtcTimeZoneId($formattedTimeZone)
$signal = '-' == $matches['signal'] ? '+' : '-';

if (0 < $minutes) {
throw new NotImplementedException(sprintf(
'It is not possible to use a GMT time zone with minutes offset different than zero (0). GMT time zone tried: %s.',
$formattedTimeZone
));
throw new NotImplementedException(sprintf('It is not possible to use a GMT time zone with minutes offset different than zero (0). GMT time zone tried: %s.', $formattedTimeZone));
}

return 'Etc/GMT'.(0 !== $hours ? $signal.$hours : '');
Expand Down
2 changes: 1 addition & 1 deletion Intl.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public static function getRegionBundle()
/**
* Returns the version of the installed ICU library.
*
* @return null|string The ICU version or NULL if it could not be determined
* @return string|null The ICU version or NULL if it could not be determined
*/
public static function getIcuVersion()
{
Expand Down
7 changes: 2 additions & 5 deletions NumberFormatter/NumberFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,7 @@ public function format($value, $type = self::TYPE_DEFAULT)
}

if (self::CURRENCY == $this->style) {
throw new NotImplementedException(sprintf(
'%s() method does not support the formatting of currencies (instance with CURRENCY style). %s',
__METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE
));
throw new NotImplementedException(sprintf('%s() method does not support the formatting of currencies (instance with CURRENCY style). %s', __METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE));
}

// Only the default type is supported.
Expand Down Expand Up @@ -519,7 +516,7 @@ public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0)
$groupSep = $this->getAttribute(self::GROUPING_USED) ? ',' : '';

// Any string before the numeric value causes error in the parsing
if (preg_match("/^-?(?:\.\d++|([\d{$groupSep}]++)(?:\.\d++)?)/", $value, $matches)) {
if (preg_match("/^-?(?:\.\d++|([\d{$groupSep}]++)(?:\.\d*+)?)/", $value, $matches)) {
$value = $matches[0];
$position = \strlen($value);
if ($error = $groupSep && isset($matches[1]) && !preg_match('/^\d{1,3}+(?:(?:,\d{3})++|\d*+)$/', $matches[1])) {
Expand Down
2 changes: 0 additions & 2 deletions Resources/data/regions/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"ER": "Eritrea",
"ES": "Spanje",
"ET": "Ethiopië",
"EZ": "Eurosone",
"FI": "Finland",
"FJ": "Fidji",
"FK": "Falklandeilande",
Expand Down Expand Up @@ -237,7 +236,6 @@
"UA": "Oekraïne",
"UG": "Uganda",
"UM": "Klein afgeleë eilande van die VSA",
"UN": "Verenigde Nasies",
"US": "Verenigde State van Amerika",
"UY": "Uruguay",
"UZ": "Oesbekistan",
Expand Down
2 changes: 0 additions & 2 deletions Resources/data/regions/am.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"ER": "ኤርትራ",
"ES": "ስፔን",
"ET": "ኢትዮጵያ",
"EZ": "የአውሮፓ ዞን",
"FI": "ፊንላንድ",
"FJ": "ፊጂ",
"FK": "የፎክላንድ ደሴቶች",
Expand Down Expand Up @@ -237,7 +236,6 @@
"UA": "ዩክሬን",
"UG": "ዩጋንዳ",
"UM": "የዩ ኤስ ጠረፍ ላይ ያሉ ደሴቶች",
"UN": "የተባበሩት መንግስታት",
"US": "ዩናይትድ ስቴትስ",
"UY": "ኡራጓይ",
"UZ": "ኡዝቤኪስታን",
Expand Down
2 changes: 0 additions & 2 deletions Resources/data/regions/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"ER": "إريتريا",
"ES": "إسبانيا",
"ET": "إثيوبيا",
"EZ": "منطقة اليورو",
"FI": "فنلندا",
"FJ": "فيجي",
"FK": "جزر فوكلاند",
Expand Down Expand Up @@ -237,7 +236,6 @@
"UA": "أوكرانيا",
"UG": "أوغندا",
"UM": "جزر الولايات المتحدة النائية",
"UN": "الأمم المتحدة",
"US": "الولايات المتحدة",
"UY": "أورغواي",
"UZ": "أوزبكستان",
Expand Down
2 changes: 0 additions & 2 deletions Resources/data/regions/as.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"ER": "এৰিত্ৰিয়া",
"ES": "স্পেইন",
"ET": "ইথিঅ’পিয়া",
"EZ": "ইউৰোজ’ন",
"FI": "ফিনলেণ্ড",
"FJ": "ফিজি",
"FK": "ফকলেণ্ড দ্বীপপুঞ্জ",
Expand Down Expand Up @@ -237,7 +236,6 @@
"UA": "ইউক্ৰেইন",
"UG": "উগাণ্ডা",
"UM": "ইউ. এছ. আউটলায়িং দ্বীপপুঞ্জ",
"UN": "ৰাষ্ট্ৰসংঘ",
"US": "মাৰ্কিন যুক্তৰাষ্ট্ৰ",
"UY": "উৰুগুৱে",
"UZ": "উজবেকিস্তান",
Expand Down
2 changes: 0 additions & 2 deletions Resources/data/regions/az.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"ER": "Eritreya",
"ES": "İspaniya",
"ET": "Efiopiya",
"EZ": "Avrozona",
"FI": "Finlandiya",
"FJ": "Fici",
"FK": "Folklend adaları",
Expand Down Expand Up @@ -237,7 +236,6 @@
"UA": "Ukrayna",
"UG": "Uqanda",
"UM": "ABŞ-a bağlı kiçik adacıqlar",
"UN": "Birləşmiş Millətlər Təşkilatı",
"US": "Amerika Birləşmiş Ştatları",
"UY": "Uruqvay",
"UZ": "Özbəkistan",
Expand Down
2 changes: 0 additions & 2 deletions Resources/data/regions/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"ER": "Эрытрэя",
"ES": "Іспанія",
"ET": "Эфіопія",
"EZ": "Еўразона",
"FI": "Фінляндыя",
"FJ": "Фіджы",
"FK": "Фалклендскія астравы",
Expand Down Expand Up @@ -237,7 +236,6 @@
"UA": "Украіна",
"UG": "Уганда",
"UM": "Малыя Аддаленыя астравы ЗША",
"UN": "ААН",
"US": "Злучаныя Штаты Амерыкі",
"UY": "Уругвай",
"UZ": "Узбекістан",
Expand Down
2 changes: 0 additions & 2 deletions Resources/data/regions/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"ER": "Еритрея",
"ES": "Испания",
"ET": "Етиопия",
"EZ": "Еврозона",
"FI": "Финландия",
"FJ": "Фиджи",
"FK": "Фолклендски острови",
Expand Down Expand Up @@ -237,7 +236,6 @@
"UA": "Украйна",
"UG": "Уганда",
"UM": "Отдалечени острови на САЩ",
"UN": "Организация на обединените нации",
"US": "Съединени щати",
"UY": "Уругвай",
"UZ": "Узбекистан",
Expand Down
2 changes: 0 additions & 2 deletions Resources/data/regions/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"ER": "ইরিত্রিয়া",
"ES": "স্পেন",
"ET": "ইথিওপিয়া",
"EZ": "ইউরোজোন",
"FI": "ফিনল্যান্ড",
"FJ": "ফিজি",
"FK": "ফকল্যান্ড দ্বীপপুঞ্জ",
Expand Down Expand Up @@ -237,7 +236,6 @@
"UA": "ইউক্রেন",
"UG": "উগান্ডা",
"UM": "যুক্তরাষ্ট্রের পার্শ্ববর্তী দ্বীপপুঞ্জ",
"UN": "জাতিসংঘ",
"US": "মার্কিন যুক্তরাষ্ট্র",
"UY": "উরুগুয়ে",
"UZ": "উজবেকিস্তান",
Expand Down
2 changes: 0 additions & 2 deletions Resources/data/regions/br.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"ER": "Eritrea",
"ES": "Spagn",
"ET": "Etiopia",
"EZ": "takad an euro",
"FI": "Finland",
"FJ": "Fidji",
"FK": "Inizi Falkland",
Expand Down Expand Up @@ -237,7 +236,6 @@
"UA": "Ukraina",
"UG": "Ouganda",
"UM": "Inizi diabell ar Stadoù-Unanet",
"UN": "Broadoù unanet",
"US": "Stadoù-Unanet",
"UY": "Uruguay",
"UZ": "Ouzbekistan",
Expand Down
2 changes: 0 additions & 2 deletions Resources/data/regions/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"ER": "Eritreja",
"ES": "Španija",
"ET": "Etiopija",
"EZ": "Eurozona",
"FI": "Finska",
"FJ": "Fidži",
"FK": "Folklandska ostrva",
Expand Down Expand Up @@ -237,7 +236,6 @@
"UA": "Ukrajina",
"UG": "Uganda",
"UM": "Američka Vanjska Ostrva",
"UN": "Ujedinjene Nacije",
"US": "Sjedinjene Američke Države",
"UY": "Urugvaj",
"UZ": "Uzbekistan",
Expand Down
2 changes: 0 additions & 2 deletions Resources/data/regions/bs_Cyrl.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"ER": "Еритреја",
"ES": "Шпанија",
"ET": "Етиопија",
"EZ": "Еурозона",
"FI": "Финска",
"FJ": "Фиџи",
"FK": "Фокландска острва",
Expand Down Expand Up @@ -236,7 +235,6 @@
"UA": "Украјина",
"UG": "Уганда",
"UM": "Мања удаљена острва САД",
"UN": "Уједињене нације",
"US": "Сједињене Америчке Државе",
"UY": "Уругвај",
"UZ": "Узбекистан",
Expand Down
Loading

0 comments on commit 6ec3640

Please sign in to comment.