Skip to content

Commit 70a941e

Browse files
committed
[Intl] Cleanup
1 parent 15e9eec commit 70a941e

14 files changed

+43
-175
lines changed

src/Symfony/Component/Intl/CONTRIBUTING.md

-91
This file was deleted.

src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php

+13-30
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,20 @@
2525
*/
2626
class CurrencyDataGenerator extends AbstractDataGenerator
2727
{
28-
const UNKNOWN_CURRENCY_ID = 'XXX';
29-
const EUROPEAN_COMPOSITE_UNIT_ID = 'XBA';
30-
const EUROPEAN_MONETARY_UNIT_ID = 'XBB';
31-
const EUROPEAN_UNIT_OF_ACCOUNT_XBC_ID = 'XBC';
32-
const EUROPEAN_UNIT_OF_ACCOUNT_XBD_ID = 'XBD';
33-
const TESTING_CURRENCY_CODE_ID = 'XTS';
34-
const ADB_UNIT_OF_ACCOUNT_ID = 'XUA';
35-
const GOLD_ID = 'XAU';
36-
const SILVER_ID = 'XAG';
37-
const PLATINUM_ID = 'XPT';
38-
const PALLADIUM_ID = 'XPD';
39-
const SUCRE_ID = 'XSU';
40-
const SPECIAL_DRAWING_RIGHTS_ID = 'XDR';
41-
42-
/**
43-
* Monetary units excluded from generation.
44-
*/
4528
private static $blacklist = [
46-
self::UNKNOWN_CURRENCY_ID => true,
47-
self::EUROPEAN_COMPOSITE_UNIT_ID => true,
48-
self::EUROPEAN_MONETARY_UNIT_ID => true,
49-
self::EUROPEAN_UNIT_OF_ACCOUNT_XBC_ID => true,
50-
self::EUROPEAN_UNIT_OF_ACCOUNT_XBD_ID => true,
51-
self::TESTING_CURRENCY_CODE_ID => true,
52-
self::ADB_UNIT_OF_ACCOUNT_ID => true,
53-
self::GOLD_ID => true,
54-
self::SILVER_ID => true,
55-
self::PLATINUM_ID => true,
56-
self::PALLADIUM_ID => true,
57-
self::SUCRE_ID => true,
58-
self::SPECIAL_DRAWING_RIGHTS_ID => true,
29+
'XBA' => true, // European Composite Unit
30+
'XBB' => true, // European Monetary Unit
31+
'XBC' => true, // European Unit of Account (XBC)
32+
'XBD' => true, // European Unit of Account (XBD)
33+
'XUA' => true, // ADB Unit of Account
34+
'XAU' => true, // Gold
35+
'XAG' => true, // Silver
36+
'XPT' => true, // Platinum
37+
'XPD' => true, // Palladium
38+
'XSU' => true, // Sucre
39+
'XDR' => true, // Special Drawing Rights
40+
'XTS' => true, // Testing Currency Code
41+
'XXX' => true, // Unknown Currency
5942
];
6043

6144
/**

src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php

+9-23
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,18 @@
2727
*/
2828
class RegionDataGenerator extends AbstractDataGenerator
2929
{
30-
const UNKNOWN_REGION_ID = 'ZZ';
31-
const OUTLYING_OCEANIA_REGION_ID = 'QO';
32-
const EUROPEAN_UNION_ID = 'EU';
33-
const NETHERLANDS_ANTILLES_ID = 'AN';
34-
const BOUVET_ISLAND_ID = 'BV';
35-
const HEARD_MCDONALD_ISLANDS_ID = 'HM';
36-
const CLIPPERTON_ISLAND_ID = 'CP';
37-
const EUROZONE_ID = 'EZ';
38-
const UNITED_NATIONS_ID = 'UN';
39-
40-
/**
41-
* Regions excluded from generation.
42-
*/
4330
private static $blacklist = [
44-
self::UNKNOWN_REGION_ID => true,
4531
// Look like countries, but are sub-continents
46-
self::OUTLYING_OCEANIA_REGION_ID => true,
47-
self::EUROPEAN_UNION_ID => true,
48-
self::EUROZONE_ID => true,
49-
self::UNITED_NATIONS_ID => true,
50-
// No longer exists
51-
self::NETHERLANDS_ANTILLES_ID => true,
32+
'QO' => true, // Outlying Oceania
33+
'EU' => true, // European Union
34+
'EZ' => true, // Eurozone
35+
'UN' => true, // United Nations
5236
// Uninhabited islands
53-
self::BOUVET_ISLAND_ID => true,
54-
self::HEARD_MCDONALD_ISLANDS_ID => true,
55-
self::CLIPPERTON_ISLAND_ID => true,
37+
'BV' => true, // Bouvet Island
38+
'HM' => true, // Heard & McDonald Islands
39+
'CP' => true, // Clipperton Island
40+
// Misc
41+
'ZZ' => true, // Unknown Region
5642
];
5743

5844
/**

src/Symfony/Component/Intl/Data/Provider/CurrencyDataProvider.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
1515
use Symfony\Component\Intl\Exception\MissingResourceException;
16-
use Symfony\Component\Intl\Locale;
1716

1817
/**
1918
* Data provider for currency-related data.
@@ -53,7 +52,7 @@ public function getCurrencies()
5352
public function getSymbol($currency, $displayLocale = null)
5453
{
5554
if (null === $displayLocale) {
56-
$displayLocale = Locale::getDefault();
55+
$displayLocale = \Locale::getDefault();
5756
}
5857

5958
return $this->reader->readEntry($this->path, $displayLocale, ['Names', $currency, static::INDEX_SYMBOL]);
@@ -62,7 +61,7 @@ public function getSymbol($currency, $displayLocale = null)
6261
public function getName($currency, $displayLocale = null)
6362
{
6463
if (null === $displayLocale) {
65-
$displayLocale = Locale::getDefault();
64+
$displayLocale = \Locale::getDefault();
6665
}
6766

6867
return $this->reader->readEntry($this->path, $displayLocale, ['Names', $currency, static::INDEX_NAME]);
@@ -71,7 +70,7 @@ public function getName($currency, $displayLocale = null)
7170
public function getNames($displayLocale = null)
7271
{
7372
if (null === $displayLocale) {
74-
$displayLocale = Locale::getDefault();
73+
$displayLocale = \Locale::getDefault();
7574
}
7675

7776
// ====================================================================

src/Symfony/Component/Intl/Data/Provider/LanguageDataProvider.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Intl\Data\Provider;
1313

1414
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
15-
use Symfony\Component\Intl\Locale;
1615

1716
/**
1817
* Data provider for language-related ICU data.
@@ -51,7 +50,7 @@ public function getAliases()
5150
public function getName($language, $displayLocale = null)
5251
{
5352
if (null === $displayLocale) {
54-
$displayLocale = Locale::getDefault();
53+
$displayLocale = \Locale::getDefault();
5554
}
5655

5756
return $this->reader->readEntry($this->path, $displayLocale, ['Names', $language]);
@@ -60,7 +59,7 @@ public function getName($language, $displayLocale = null)
6059
public function getNames($displayLocale = null)
6160
{
6261
if (null === $displayLocale) {
63-
$displayLocale = Locale::getDefault();
62+
$displayLocale = \Locale::getDefault();
6463
}
6564

6665
$languages = $this->reader->readEntry($this->path, $displayLocale, ['Names']);

src/Symfony/Component/Intl/Data/Provider/LocaleDataProvider.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Intl\Data\Provider;
1313

1414
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
15-
use Symfony\Component\Intl\Locale;
1615

1716
/**
1817
* Data provider for locale-related ICU data.
@@ -57,7 +56,7 @@ public function getAliases()
5756
public function getName($locale, $displayLocale = null)
5857
{
5958
if (null === $displayLocale) {
60-
$displayLocale = Locale::getDefault();
59+
$displayLocale = \Locale::getDefault();
6160
}
6261

6362
return $this->reader->readEntry($this->path, $displayLocale, ['Names', $locale]);
@@ -66,7 +65,7 @@ public function getName($locale, $displayLocale = null)
6665
public function getNames($displayLocale = null)
6766
{
6867
if (null === $displayLocale) {
69-
$displayLocale = Locale::getDefault();
68+
$displayLocale = \Locale::getDefault();
7069
}
7170

7271
$names = $this->reader->readEntry($this->path, $displayLocale, ['Names']);

src/Symfony/Component/Intl/Data/Provider/RegionDataProvider.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Intl\Data\Provider;
1313

1414
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
15-
use Symfony\Component\Intl\Locale;
1615

1716
/**
1817
* Data provider for region-related ICU data.
@@ -46,7 +45,7 @@ public function getRegions()
4645
public function getName($region, $displayLocale = null)
4746
{
4847
if (null === $displayLocale) {
49-
$displayLocale = Locale::getDefault();
48+
$displayLocale = \Locale::getDefault();
5049
}
5150

5251
return $this->reader->readEntry($this->path, $displayLocale, ['Names', $region]);
@@ -55,7 +54,7 @@ public function getName($region, $displayLocale = null)
5554
public function getNames($displayLocale = null)
5655
{
5756
if (null === $displayLocale) {
58-
$displayLocale = Locale::getDefault();
57+
$displayLocale = \Locale::getDefault();
5958
}
6059

6160
$names = $this->reader->readEntry($this->path, $displayLocale, ['Names']);

src/Symfony/Component/Intl/Data/Provider/ScriptDataProvider.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Intl\Data\Provider;
1313

1414
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
15-
use Symfony\Component\Intl\Locale;
1615

1716
/**
1817
* Data provider for script-related ICU data.
@@ -46,7 +45,7 @@ public function getScripts()
4645
public function getName($script, $displayLocale = null)
4746
{
4847
if (null === $displayLocale) {
49-
$displayLocale = Locale::getDefault();
48+
$displayLocale = \Locale::getDefault();
5049
}
5150

5251
return $this->reader->readEntry($this->path, $displayLocale, ['Names', $script]);
@@ -55,7 +54,7 @@ public function getName($script, $displayLocale = null)
5554
public function getNames($displayLocale = null)
5655
{
5756
if (null === $displayLocale) {
58-
$displayLocale = Locale::getDefault();
57+
$displayLocale = \Locale::getDefault();
5958
}
6059

6160
$names = $this->reader->readEntry($this->path, $displayLocale, ['Names']);

src/Symfony/Component/Intl/Tests/Data/Provider/AbstractCurrencyDataProviderTest.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\Intl\Data\Provider\CurrencyDataProvider;
1515
use Symfony\Component\Intl\Intl;
16-
use Symfony\Component\Intl\Locale;
1716

1817
/**
1918
* @author Bernhard Schussek <bschussek@gmail.com>
@@ -631,7 +630,7 @@ public function testGetNames($displayLocale)
631630

632631
public function testGetNamesDefaultLocale()
633632
{
634-
Locale::setDefault('de_AT');
633+
\Locale::setDefault('de_AT');
635634

636635
$this->assertSame(
637636
$this->dataProvider->getNames('de_AT'),
@@ -670,7 +669,7 @@ public function testGetName($displayLocale)
670669

671670
public function testGetNameDefaultLocale()
672671
{
673-
Locale::setDefault('de_AT');
672+
\Locale::setDefault('de_AT');
674673

675674
$expected = $this->dataProvider->getNames('de_AT');
676675
$actual = [];

src/Symfony/Component/Intl/Tests/Data/Provider/AbstractDataProviderTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ abstract class AbstractDataProviderTest extends TestCase
703703

704704
protected function setUp()
705705
{
706-
Locale::setDefault('en');
706+
\Locale::setDefault('en');
707707
Locale::setDefaultFallback('en');
708708
}
709709

src/Symfony/Component/Intl/Tests/Data/Provider/AbstractLanguageDataProviderTest.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\Intl\Data\Provider\LanguageDataProvider;
1515
use Symfony\Component\Intl\Intl;
16-
use Symfony\Component\Intl\Locale;
1716

1817
/**
1918
* @author Bernhard Schussek <bschussek@gmail.com>
@@ -865,7 +864,7 @@ public function testGetNames($displayLocale)
865864

866865
public function testGetNamesDefaultLocale()
867866
{
868-
Locale::setDefault('de_AT');
867+
\Locale::setDefault('de_AT');
869868

870869
$this->assertSame(
871870
$this->dataProvider->getNames('de_AT'),
@@ -901,7 +900,7 @@ public function testGetName($displayLocale)
901900

902901
public function testGetNameDefaultLocale()
903902
{
904-
Locale::setDefault('de_AT');
903+
\Locale::setDefault('de_AT');
905904

906905
$names = $this->dataProvider->getNames('de_AT');
907906

0 commit comments

Comments
 (0)