Skip to content

Commit 8982713

Browse files
committed
switched array() to []
1 parent e79bfb7 commit 8982713

File tree

63 files changed

+1080
-1080
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1080
-1080
lines changed

Collator/Collator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ public static function create($locale)
108108
*/
109109
public function asort(&$array, $sortFlag = self::SORT_REGULAR)
110110
{
111-
$intlToPlainFlagMap = array(
111+
$intlToPlainFlagMap = [
112112
self::SORT_REGULAR => \SORT_REGULAR,
113113
self::SORT_NUMERIC => \SORT_NUMERIC,
114114
self::SORT_STRING => \SORT_STRING,
115-
);
115+
];
116116

117117
$plainSortFlag = isset($intlToPlainFlagMap[$sortFlag]) ? $intlToPlainFlagMap[$sortFlag] : self::SORT_REGULAR;
118118

Data/Bundle/Reader/BundleEntryReader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class BundleEntryReader implements BundleEntryReaderInterface
3333
/**
3434
* A mapping of locale aliases to locales.
3535
*/
36-
private $localeAliases = array();
36+
private $localeAliases = [];
3737

3838
/**
3939
* Creates an entry reader based on the given resource bundle reader.
@@ -76,7 +76,7 @@ public function readEntry($path, $locale, array $indices, $fallback = true)
7676
$readSucceeded = false;
7777
$exception = null;
7878
$currentLocale = $locale;
79-
$testedLocales = array();
79+
$testedLocales = [];
8080

8181
while (null !== $currentLocale) {
8282
// Resolve any aliases to their target locales

Data/Generator/CurrencyDataGenerator.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
4242
/**
4343
* Monetary units excluded from generation.
4444
*/
45-
private static $blacklist = array(
45+
private static $blacklist = [
4646
self::UNKNOWN_CURRENCY_ID => true,
4747
self::EUROPEAN_COMPOSITE_UNIT_ID => true,
4848
self::EUROPEAN_MONETARY_UNIT_ID => true,
@@ -56,14 +56,14 @@ class CurrencyDataGenerator extends AbstractDataGenerator
5656
self::PALLADIUM_ID => true,
5757
self::SUCRE_ID => true,
5858
self::SPECIAL_DRAWING_RIGHTS_ID => true,
59-
);
59+
];
6060

6161
/**
6262
* Collects all available currency codes.
6363
*
6464
* @var string[]
6565
*/
66-
private $currencyCodes = array();
66+
private $currencyCodes = [];
6767

6868
/**
6969
* {@inheritdoc}
@@ -87,7 +87,7 @@ protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir,
8787
*/
8888
protected function preGenerate()
8989
{
90-
$this->currencyCodes = array();
90+
$this->currencyCodes = [];
9191
}
9292

9393
/**
@@ -98,10 +98,10 @@ protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir
9898
$localeBundle = $reader->read($tempDir, $displayLocale);
9999

100100
if (isset($localeBundle['Currencies']) && null !== $localeBundle['Currencies']) {
101-
$data = array(
101+
$data = [
102102
'Version' => $localeBundle['Version'],
103103
'Names' => $this->generateSymbolNamePairs($localeBundle),
104-
);
104+
];
105105

106106
$this->currencyCodes = array_merge($this->currencyCodes, array_keys($data['Names']));
107107

@@ -116,10 +116,10 @@ protected function generateDataForRoot(BundleReaderInterface $reader, $tempDir)
116116
{
117117
$rootBundle = $reader->read($tempDir, 'root');
118118

119-
return array(
119+
return [
120120
'Version' => $rootBundle['Version'],
121121
'Names' => $this->generateSymbolNamePairs($rootBundle),
122-
);
122+
];
123123
}
124124

125125
/**
@@ -135,12 +135,12 @@ protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir)
135135

136136
sort($this->currencyCodes);
137137

138-
$data = array(
138+
$data = [
139139
'Version' => $rootBundle['Version'],
140140
'Currencies' => $this->currencyCodes,
141141
'Meta' => $this->generateCurrencyMeta($supplementalDataBundle),
142142
'Alpha3ToNumeric' => $this->generateAlpha3ToNumericMapping($numericCodesBundle, $this->currencyCodes),
143-
);
143+
];
144144

145145
$data['NumericToAlpha3'] = $this->generateNumericToAlpha3Mapping($data['Alpha3ToNumeric']);
146146

@@ -181,14 +181,14 @@ private function generateAlpha3ToNumericMapping(ArrayAccessibleResourceBundle $n
181181

182182
private function generateNumericToAlpha3Mapping(array $alpha3ToNumericMapping)
183183
{
184-
$numericToAlpha3Mapping = array();
184+
$numericToAlpha3Mapping = [];
185185

186186
foreach ($alpha3ToNumericMapping as $alpha3 => $numeric) {
187187
// Make sure that the mapping is stored as table and not as array
188188
$numeric = (string) $numeric;
189189

190190
if (!isset($numericToAlpha3Mapping[$numeric])) {
191-
$numericToAlpha3Mapping[$numeric] = array();
191+
$numericToAlpha3Mapping[$numeric] = [];
192192
}
193193

194194
$numericToAlpha3Mapping[$numeric][] = $alpha3;

Data/Generator/GeneratorConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class GeneratorConfig
2828
/**
2929
* @var BundleWriterInterface[]
3030
*/
31-
private $bundleWriters = array();
31+
private $bundleWriters = [];
3232

3333
/**
3434
* @param string $sourceDir

Data/Generator/LanguageDataGenerator.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class LanguageDataGenerator extends AbstractDataGenerator
2929
/**
3030
* Source: http://www-01.sil.org/iso639-3/codes.asp.
3131
*/
32-
private static $preferredAlpha2ToAlpha3Mapping = array(
32+
private static $preferredAlpha2ToAlpha3Mapping = [
3333
'ak' => 'aka',
3434
'ar' => 'ara',
3535
'ay' => 'aym',
@@ -81,14 +81,14 @@ class LanguageDataGenerator extends AbstractDataGenerator
8181
'yi' => 'yid',
8282
'za' => 'zha',
8383
'zh' => 'zho',
84-
);
84+
];
8585

8686
/**
8787
* Collects all available language codes.
8888
*
8989
* @var string[]
9090
*/
91-
private $languageCodes = array();
91+
private $languageCodes = [];
9292

9393
/**
9494
* {@inheritdoc}
@@ -112,7 +112,7 @@ protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir,
112112
*/
113113
protected function preGenerate()
114114
{
115-
$this->languageCodes = array();
115+
$this->languageCodes = [];
116116
}
117117

118118
/**
@@ -124,10 +124,10 @@ protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir
124124

125125
// isset() on \ResourceBundle returns true even if the value is null
126126
if (isset($localeBundle['Languages']) && null !== $localeBundle['Languages']) {
127-
$data = array(
127+
$data = [
128128
'Version' => $localeBundle['Version'],
129129
'Names' => iterator_to_array($localeBundle['Languages']),
130-
);
130+
];
131131

132132
$this->languageCodes = array_merge($this->languageCodes, array_keys($data['Names']));
133133

@@ -154,18 +154,18 @@ protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir)
154154

155155
sort($this->languageCodes);
156156

157-
return array(
157+
return [
158158
'Version' => $rootBundle['Version'],
159159
'Languages' => $this->languageCodes,
160160
'Aliases' => array_column(iterator_to_array($metadataBundle['alias']['language']), 'replacement'),
161161
'Alpha2ToAlpha3' => $this->generateAlpha2ToAlpha3Mapping($metadataBundle),
162-
);
162+
];
163163
}
164164

165165
private function generateAlpha2ToAlpha3Mapping(ArrayAccessibleResourceBundle $metadataBundle)
166166
{
167167
$aliases = iterator_to_array($metadataBundle['alias']['language']);
168-
$alpha2ToAlpha3 = array();
168+
$alpha2ToAlpha3 = [];
169169

170170
foreach ($aliases as $alias => $language) {
171171
$language = $language['replacement'];

Data/Generator/LocaleDataGenerator.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ public function generateData(GeneratorConfig $config)
7070
// Generate a list of (existing) locale fallbacks
7171
$fallbackMapping = $this->generateFallbackMapping($displayLocales, $aliases);
7272

73-
$localeNames = array();
73+
$localeNames = [];
7474

7575
// Generate locale names for all locales that have translations in
7676
// at least the language or the region bundle
7777
foreach ($displayLocales as $displayLocale => $_) {
78-
$localeNames[$displayLocale] = array();
78+
$localeNames[$displayLocale] = [];
7979

8080
foreach ($locales as $locale) {
8181
try {
@@ -111,28 +111,28 @@ public function generateData(GeneratorConfig $config)
111111
}
112112

113113
foreach ($writers as $targetDir => $writer) {
114-
$writer->write($targetDir.'/'.$this->dirName, $displayLocale, array(
114+
$writer->write($targetDir.'/'.$this->dirName, $displayLocale, [
115115
'Names' => $localeNames[$displayLocale],
116-
));
116+
]);
117117
}
118118
}
119119

120120
// Generate aliases, needed to enable proper fallback from alias to its
121121
// target
122122
foreach ($aliases as $alias => $aliasOf) {
123123
foreach ($writers as $targetDir => $writer) {
124-
$writer->write($targetDir.'/'.$this->dirName, $alias, array(
124+
$writer->write($targetDir.'/'.$this->dirName, $alias, [
125125
'%%ALIAS' => $aliasOf,
126-
));
126+
]);
127127
}
128128
}
129129

130130
// Create root file which maps locale codes to locale codes, for fallback
131131
foreach ($writers as $targetDir => $writer) {
132-
$writer->write($targetDir.'/'.$this->dirName, 'meta', array(
132+
$writer->write($targetDir.'/'.$this->dirName, 'meta', [
133133
'Locales' => $locales,
134134
'Aliases' => $aliases,
135-
));
135+
]);
136136
}
137137
}
138138

@@ -168,7 +168,7 @@ private function generateLocaleName($locale, $displayLocale)
168168
// continue;
169169
//}
170170

171-
$extras = array();
171+
$extras = [];
172172

173173
// Discover the name of the script part of the locale
174174
// i.e. in zh_Hans_MO, "Hans" is the script
@@ -209,7 +209,7 @@ private function generateLocaleName($locale, $displayLocale)
209209

210210
private function generateFallbackMapping(array $displayLocales, array $aliases)
211211
{
212-
$mapping = array();
212+
$mapping = [];
213213

214214
foreach ($displayLocales as $displayLocale => $_) {
215215
$mapping[$displayLocale] = null;

Data/Generator/RegionDataGenerator.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class RegionDataGenerator extends AbstractDataGenerator
4040
/**
4141
* Regions excluded from generation.
4242
*/
43-
private static $blacklist = array(
43+
private static $blacklist = [
4444
self::UNKNOWN_REGION_ID => true,
4545
// Look like countries, but are sub-continents
4646
self::OUTLYING_OCEANIA_REGION_ID => true,
@@ -53,14 +53,14 @@ class RegionDataGenerator extends AbstractDataGenerator
5353
self::BOUVET_ISLAND_ID => true,
5454
self::HEARD_MCDONALD_ISLANDS_ID => true,
5555
self::CLIPPERTON_ISLAND_ID => true,
56-
);
56+
];
5757

5858
/**
5959
* Collects all available language codes.
6060
*
6161
* @var string[]
6262
*/
63-
private $regionCodes = array();
63+
private $regionCodes = [];
6464

6565
/**
6666
* {@inheritdoc}
@@ -83,7 +83,7 @@ protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir,
8383
*/
8484
protected function preGenerate()
8585
{
86-
$this->regionCodes = array();
86+
$this->regionCodes = [];
8787
}
8888

8989
/**
@@ -95,10 +95,10 @@ protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir
9595

9696
// isset() on \ResourceBundle returns true even if the value is null
9797
if (isset($localeBundle['Countries']) && null !== $localeBundle['Countries']) {
98-
$data = array(
98+
$data = [
9999
'Version' => $localeBundle['Version'],
100100
'Names' => $this->generateRegionNames($localeBundle),
101-
);
101+
];
102102

103103
$this->regionCodes = array_merge($this->regionCodes, array_keys($data['Names']));
104104

@@ -124,10 +124,10 @@ protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir)
124124

125125
sort($this->regionCodes);
126126

127-
return array(
127+
return [
128128
'Version' => $rootBundle['Version'],
129129
'Regions' => $this->regionCodes,
130-
);
130+
];
131131
}
132132

133133
/**
@@ -136,7 +136,7 @@ protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir)
136136
protected function generateRegionNames(ArrayAccessibleResourceBundle $localeBundle)
137137
{
138138
$unfilteredRegionNames = iterator_to_array($localeBundle['Countries']);
139-
$regionNames = array();
139+
$regionNames = [];
140140

141141
foreach ($unfilteredRegionNames as $region => $regionName) {
142142
if (isset(self::$blacklist[$region])) {

Data/Generator/ScriptDataGenerator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ScriptDataGenerator extends AbstractDataGenerator
2929
*
3030
* @var string[]
3131
*/
32-
private $scriptCodes = array();
32+
private $scriptCodes = [];
3333

3434
/**
3535
* {@inheritdoc}
@@ -52,7 +52,7 @@ protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir,
5252
*/
5353
protected function preGenerate()
5454
{
55-
$this->scriptCodes = array();
55+
$this->scriptCodes = [];
5656
}
5757

5858
/**
@@ -64,10 +64,10 @@ protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir
6464

6565
// isset() on \ResourceBundle returns true even if the value is null
6666
if (isset($localeBundle['Scripts']) && null !== $localeBundle['Scripts']) {
67-
$data = array(
67+
$data = [
6868
'Version' => $localeBundle['Version'],
6969
'Names' => iterator_to_array($localeBundle['Scripts']),
70-
);
70+
];
7171

7272
$this->scriptCodes = array_merge($this->scriptCodes, array_keys($data['Names']));
7373

@@ -93,9 +93,9 @@ protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir)
9393

9494
sort($this->scriptCodes);
9595

96-
return array(
96+
return [
9797
'Version' => $rootBundle['Version'],
9898
'Scripts' => $this->scriptCodes,
99-
);
99+
];
100100
}
101101
}

0 commit comments

Comments
 (0)