Skip to content

Commit b14226d

Browse files
committed
Merge branch '4.1' into 4.2
* 4.1: fixed tests fixed CS fixed CS fixed CS fixed short array CS in comments fixed CS in ExpressionLanguage fixtures fixed CS in generated files fixed CS on generated container files fixed CS on Form PHP templates fixed CS on YAML fixtures fixed fixtures switched array() to []
2 parents 9bc515d + abd522a commit b14226d

File tree

61 files changed

+1068
-1066
lines changed

Some content is hidden

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

61 files changed

+1068
-1066
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/Bundle/Reader/BundleEntryReaderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface BundleEntryReaderInterface extends BundleReaderInterface
3535
*
3636
* Then the value can be read by calling:
3737
*
38-
* $reader->readEntry('...', 'en', array('TopLevel', 'NestedLevel', 'Entry'));
38+
* $reader->readEntry('...', 'en', ['TopLevel', 'NestedLevel', 'Entry']);
3939
*
4040
* @param string $path The path to the resource bundle
4141
* @param string $locale The locale to read

Data/Bundle/Writer/PhpBundleWriter.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ public function write($path, $locale, $data)
4343
});
4444

4545
$data = var_export($data, true);
46-
$data = preg_replace('/array \(/', 'array(', $data);
47-
$data = preg_replace('/\n {1,10}array\(/', 'array(', $data);
46+
$data = preg_replace('/array \(/', '[', $data);
47+
$data = preg_replace('/\n {1,10}\[/', '[', $data);
4848
$data = preg_replace('/ /', ' ', $data);
49+
$data = preg_replace('/\),$/m', '],', $data);
50+
$data = preg_replace('/\)$/', ']', $data);
4951
$data = sprintf($template, $data);
5052

5153
file_put_contents($path.'/'.$locale.'.php', $data);

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
public function __construct(string $sourceDir, string $icuVersion)
3434
{

Data/Generator/LocaleDataGenerator.php

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

74-
$localeNames = array();
74+
$localeNames = [];
7575

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

8181
foreach ($locales as $locale) {
8282
try {
@@ -112,28 +112,28 @@ public function generateData(GeneratorConfig $config)
112112
}
113113

114114
foreach ($writers as $targetDir => $writer) {
115-
$writer->write($targetDir.'/'.$this->dirName, $displayLocale, array(
115+
$writer->write($targetDir.'/'.$this->dirName, $displayLocale, [
116116
'Names' => $localeNames[$displayLocale],
117-
));
117+
]);
118118
}
119119
}
120120

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

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

139139
// Write parents locale file for the Translation component
@@ -175,7 +175,7 @@ private function generateLocaleName($locale, $displayLocale)
175175
// continue;
176176
//}
177177

178-
$extras = array();
178+
$extras = [];
179179

180180
// Discover the name of the script part of the locale
181181
// i.e. in zh_Hans_MO, "Hans" is the script
@@ -216,7 +216,7 @@ private function generateLocaleName($locale, $displayLocale)
216216

217217
private function generateFallbackMapping(array $displayLocales, array $aliases)
218218
{
219-
$mapping = array();
219+
$mapping = [];
220220

221221
foreach ($displayLocales as $displayLocale => $_) {
222222
$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)