Skip to content

Commit a684a1e

Browse files
Merge branch '4.0' into 4.1
* 4.0: Fix Clidumper tests Enable the fixer enforcing fully-qualified calls for compiler-optimized functions Apply fixers Disable the native_constant_invocation fixer until it can be scoped Update the list of excluded files for the CS fixer
2 parents cb21b90 + 15cc766 commit a684a1e

22 files changed

+52
-52
lines changed

Data/Bundle/Reader/BundleEntryReader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function readEntry($path, $locale, array $indices, $fallback = true)
9090
$readSucceeded = true;
9191

9292
$isCurrentTraversable = $currentEntry instanceof \Traversable;
93-
$isCurrentMultiValued = $isCurrentTraversable || is_array($currentEntry);
93+
$isCurrentMultiValued = $isCurrentTraversable || \is_array($currentEntry);
9494

9595
// Return immediately if fallback is disabled or we are dealing
9696
// with a scalar non-null entry
@@ -162,7 +162,7 @@ public function readEntry($path, $locale, array $indices, $fallback = true)
162162
);
163163

164164
// Append fallback locales, if any
165-
if (count($testedLocales) > 1) {
165+
if (\count($testedLocales) > 1) {
166166
// Remove original locale
167167
array_shift($testedLocales);
168168

Data/Bundle/Reader/JsonBundleReader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function read($path, $locale)
3131
$fileName = $path.'/'.$locale.'.json';
3232

3333
// prevent directory traversal attacks
34-
if (dirname($fileName) !== $path) {
34+
if (\dirname($fileName) !== $path) {
3535
throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s" does not exist.', $fileName));
3636
}
3737

Data/Bundle/Reader/PhpBundleReader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function read($path, $locale)
3131
$fileName = $path.'/'.$locale.'.php';
3232

3333
// prevent directory traversal attacks
34-
if (dirname($fileName) !== $path) {
34+
if (\dirname($fileName) !== $path) {
3535
throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s" does not exist.', $fileName));
3636
}
3737

Data/Bundle/Writer/TextBundleWriter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private function writeResourceBundle($file, $bundleName, $value, $fallback)
7272
*/
7373
private function writeResource($file, $value, $indentation, $requireBraces = true)
7474
{
75-
if (is_int($value)) {
75+
if (\is_int($value)) {
7676
$this->writeInteger($file, $value);
7777

7878
return;
@@ -82,13 +82,13 @@ private function writeResource($file, $value, $indentation, $requireBraces = tru
8282
$value = iterator_to_array($value);
8383
}
8484

85-
if (is_array($value)) {
86-
$intValues = count($value) === count(array_filter($value, 'is_int'));
85+
if (\is_array($value)) {
86+
$intValues = \count($value) === \count(array_filter($value, 'is_int'));
8787

8888
$keys = array_keys($value);
8989

9090
// check that the keys are 0-indexed and ascending
91-
$intKeys = $keys === range(0, count($keys) - 1);
91+
$intKeys = $keys === range(0, \count($keys) - 1);
9292

9393
if ($intValues && $intKeys) {
9494
$this->writeIntVector($file, $value, $indentation);
@@ -107,7 +107,7 @@ private function writeResource($file, $value, $indentation, $requireBraces = tru
107107
return;
108108
}
109109

110-
if (is_bool($value)) {
110+
if (\is_bool($value)) {
111111
$value = $value ? 'true' : 'false';
112112
}
113113

@@ -206,7 +206,7 @@ private function writeArray($file, array $value, $indentation)
206206
*/
207207
private function writeTable($file, $value, $indentation, $fallback = true)
208208
{
209-
if (!is_array($value) && !$value instanceof \Traversable) {
209+
if (!\is_array($value) && !$value instanceof \Traversable) {
210210
throw new UnexpectedTypeException($value, 'array or \Traversable');
211211
}
212212

Data/Generator/LanguageDataGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private function generateAlpha2ToAlpha3Mapping(ArrayAccessibleResourceBundle $me
169169

170170
foreach ($aliases as $alias => $language) {
171171
$language = $language['replacement'];
172-
if (2 === strlen($language) && 3 === strlen($alias)) {
172+
if (2 === \strlen($language) && 3 === \strlen($alias)) {
173173
if (isset(self::$preferredAlpha2ToAlpha3Mapping[$language])) {
174174
// Validate to prevent typos
175175
if (!isset($aliases[self::$preferredAlpha2ToAlpha3Mapping[$language]])) {

Data/Generator/LocaleDataGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function generateData(GeneratorConfig $config)
106106
}
107107

108108
// If no names remain to be saved for the current locale, skip it
109-
if (0 === count($localeNames[$displayLocale])) {
109+
if (0 === \count($localeNames[$displayLocale])) {
110110
continue;
111111
}
112112

@@ -147,7 +147,7 @@ private function generateLocaleName($locale, $displayLocale)
147147

148148
// Currently the only available variant is POSIX, which we don't want
149149
// to include in the list
150-
if (count($variants) > 0) {
150+
if (\count($variants) > 0) {
151151
return;
152152
}
153153

@@ -192,7 +192,7 @@ private function generateLocaleName($locale, $displayLocale)
192192
$extras[] = $regionName;
193193
}
194194

195-
if (count($extras) > 0) {
195+
if (\count($extras) > 0) {
196196
// Remove any existing extras
197197
// For example, in German, zh_Hans is "Chinesisch (vereinfacht)".
198198
// The latter is the script part which is already included in the
@@ -219,7 +219,7 @@ private function generateFallbackMapping(array $displayLocales, array $aliases)
219219
while (null !== ($fallback = Locale::getFallback($fallback))) {
220220
// Currently, no locale has an alias as fallback locale.
221221
// If this starts to be the case, we need to add code here.
222-
assert(!isset($aliases[$fallback]));
222+
\assert(!isset($aliases[$fallback]));
223223

224224
// Check whether the fallback exists
225225
if (isset($displayLocales[$fallback])) {

Data/Generator/RegionDataGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ protected function generateRegionNames(ArrayAccessibleResourceBundle $localeBund
140140
}
141141

142142
// WORLD/CONTINENT/SUBCONTINENT/GROUPING
143-
if (ctype_digit($region) || is_int($region)) {
143+
if (ctype_digit($region) || \is_int($region)) {
144144
continue;
145145
}
146146

Data/Util/RecursiveArrayAccess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static function get($array, array $indices)
2424
{
2525
foreach ($indices as $index) {
2626
// Use array_key_exists() for arrays, isset() otherwise
27-
if (is_array($array)) {
27+
if (\is_array($array)) {
2828
if (array_key_exists($index, $array)) {
2929
$array = $array[$index];
3030
continue;

DateFormatter/DateFormat/FullTransformer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function format(\DateTime $dateTime)
107107
*/
108108
public function formatReplace($dateChars, $dateTime)
109109
{
110-
$length = strlen($dateChars);
110+
$length = \strlen($dateChars);
111111

112112
if ($this->isQuoteMatch($dateChars)) {
113113
return $this->replaceQuoteMatch($dateChars);
@@ -147,7 +147,7 @@ public function parse(\DateTime $dateTime, $value)
147147

148148
foreach ($this->transformers as $char => $transformer) {
149149
if (isset($matches[$char])) {
150-
$length = strlen($matches[$char]['pattern']);
150+
$length = \strlen($matches[$char]['pattern']);
151151
$options = array_merge($options, $transformer->extractDateOptions($matches[$char]['value'], $length));
152152
}
153153
}
@@ -181,7 +181,7 @@ public function getReverseMatchingRegExp($pattern)
181181
$escapedPattern = preg_replace('/\\\[\-|\/]/', '[\/\-]', $escapedPattern);
182182

183183
$reverseMatchingRegExp = preg_replace_callback($this->regExp, function ($matches) {
184-
$length = strlen($matches[0]);
184+
$length = \strlen($matches[0]);
185185
$transformerIndex = $matches[0][0];
186186

187187
$dateChars = $matches[0];
@@ -258,7 +258,7 @@ protected function normalizeArray(array $data)
258258
$ret = array();
259259

260260
foreach ($data as $key => $value) {
261-
if (!is_string($key)) {
261+
if (!\is_string($key)) {
262262
continue;
263263
}
264264

@@ -313,7 +313,7 @@ protected function calculateUnixTimestamp(\DateTime $dateTime, array $options)
313313

314314
// Normalize yy year
315315
preg_match_all($this->regExp, $this->pattern, $matches);
316-
if (in_array('yy', $matches[0])) {
316+
if (\in_array('yy', $matches[0])) {
317317
$dateTime->setTimestamp(time());
318318
$year = $year > $dateTime->format('y') + 20 ? 1900 + $year : 2000 + $year;
319319
}

DateFormatter/DateFormat/MonthTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class MonthTransformer extends Transformer
5252

5353
public function __construct()
5454
{
55-
if (0 === count(self::$shortMonths)) {
55+
if (0 === \count(self::$shortMonths)) {
5656
self::$shortMonths = array_map(function ($month) {
5757
return substr($month, 0, 3);
5858
}, self::$months);

0 commit comments

Comments
 (0)