Skip to content

Commit 41ab1ff

Browse files
Merge branch '2.8' into 3.4
* 2.8: 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 0d1c096 + 44383e4 commit 41ab1ff

28 files changed

+58
-58
lines changed

Catalogue/AbstractOperation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function getDomains()
9191
*/
9292
public function getMessages($domain)
9393
{
94-
if (!in_array($domain, $this->getDomains())) {
94+
if (!\in_array($domain, $this->getDomains())) {
9595
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
9696
}
9797

@@ -107,7 +107,7 @@ public function getMessages($domain)
107107
*/
108108
public function getNewMessages($domain)
109109
{
110-
if (!in_array($domain, $this->getDomains())) {
110+
if (!\in_array($domain, $this->getDomains())) {
111111
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
112112
}
113113

@@ -123,7 +123,7 @@ public function getNewMessages($domain)
123123
*/
124124
public function getObsoleteMessages($domain)
125125
{
126-
if (!in_array($domain, $this->getDomains())) {
126+
if (!\in_array($domain, $this->getDomains())) {
127127
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
128128
}
129129

Command/XliffLintCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private function display(SymfonyStyle $io, array $files)
143143

144144
private function displayTxt(SymfonyStyle $io, array $filesInfo)
145145
{
146-
$countFiles = count($filesInfo);
146+
$countFiles = \count($filesInfo);
147147
$erroredFiles = 0;
148148

149149
foreach ($filesInfo as $info) {
@@ -193,7 +193,7 @@ private function getFiles($fileOrDirectory)
193193
}
194194

195195
foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) {
196-
if (!in_array($file->getExtension(), array('xlf', 'xliff'))) {
196+
if (!\in_array($file->getExtension(), array('xlf', 'xliff'))) {
197197
continue;
198198
}
199199

@@ -225,7 +225,7 @@ private function getDirectoryIterator($directory)
225225
};
226226

227227
if (null !== $this->directoryIteratorProvider) {
228-
return call_user_func($this->directoryIteratorProvider, $directory, $default);
228+
return \call_user_func($this->directoryIteratorProvider, $directory, $default);
229229
}
230230

231231
return $default($directory);
@@ -238,7 +238,7 @@ private function isReadable($fileOrDirectory)
238238
};
239239

240240
if (null !== $this->isReadableProvider) {
241-
return call_user_func($this->isReadableProvider, $fileOrDirectory, $default);
241+
return \call_user_func($this->isReadableProvider, $fileOrDirectory, $default);
242242
}
243243

244244
return $default($fileOrDirectory);

DataCollector/TranslationDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function getLocale()
9999

100100
public function getFallbackLocales()
101101
{
102-
return (isset($this->data['fallback_locales']) && count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : array();
102+
return (isset($this->data['fallback_locales']) && \count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : array();
103103
}
104104

105105
/**
@@ -158,7 +158,7 @@ private function sanitizeString($string, $length = 80)
158158
if (mb_strlen($string, $encoding) > $length) {
159159
return mb_substr($string, 0, $length - 3, $encoding).'...';
160160
}
161-
} elseif (strlen($string) > $length) {
161+
} elseif (\strlen($string) > $length) {
162162
return substr($string, 0, $length - 3).'...';
163163
}
164164

DataCollectorTranslator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter
3535
public function __construct(TranslatorInterface $translator)
3636
{
3737
if (!$translator instanceof TranslatorBagInterface) {
38-
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', get_class($translator)));
38+
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', \get_class($translator)));
3939
}
4040

4141
$this->translator = $translator;
@@ -106,7 +106,7 @@ public function getFallbackLocales()
106106
*/
107107
public function __call($method, $args)
108108
{
109-
return call_user_func_array(array($this->translator, $method), $args);
109+
return \call_user_func_array(array($this->translator, $method), $args);
110110
}
111111

112112
/**

DependencyInjection/TranslatorPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class TranslatorPass implements CompilerPassInterface
2626

2727
public function __construct($translatorServiceId = 'translator.default', $readerServiceId = 'translation.loader', $loaderTag = 'translation.loader', $debugCommandServiceId = 'console.command.translation_debug', $updateCommandServiceId = 'console.command.translation_update')
2828
{
29-
if ('translation.loader' === $readerServiceId && 2 > func_num_args()) {
29+
if ('translation.loader' === $readerServiceId && 2 > \func_num_args()) {
3030
@trigger_error(sprintf('The default value for $readerServiceId in "%s()" will change in 4.0 to "translation.reader".', __METHOD__), E_USER_DEPRECATED);
3131
}
3232

Dumper/FileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function dump(MessageCatalogue $messages, $options = array())
7979
copy($fullpath, $fullpath.'~');
8080
}
8181
} else {
82-
$directory = dirname($fullpath);
82+
$directory = \dirname($fullpath);
8383
if (!file_exists($directory) && !@mkdir($directory, 0777, true)) {
8484
throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory));
8585
}

Dumper/IcuResFileDumper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
3333
$data = $indexes = $resources = '';
3434

3535
foreach ($messages->all($domain) as $source => $target) {
36-
$indexes .= pack('v', strlen($data) + 28);
36+
$indexes .= pack('v', \strlen($data) + 28);
3737
$data .= $source."\0";
3838
}
3939

@@ -44,15 +44,15 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
4444
foreach ($messages->all($domain) as $source => $target) {
4545
$resources .= pack('V', $this->getPosition($data));
4646

47-
$data .= pack('V', strlen($target))
47+
$data .= pack('V', \strlen($target))
4848
.mb_convert_encoding($target."\0", 'UTF-16LE', 'UTF-8')
4949
.$this->writePadding($data)
5050
;
5151
}
5252

5353
$resOffset = $this->getPosition($data);
5454

55-
$data .= pack('v', count($messages->all($domain)))
55+
$data .= pack('v', \count($messages->all($domain)))
5656
.$indexes
5757
.$this->writePadding($data)
5858
.$resources
@@ -66,7 +66,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
6666
$keyTop, // Index keys top
6767
$bundleTop, // Index resources top
6868
$bundleTop, // Index bundle top
69-
count($messages->all($domain)), // Index max table length
69+
\count($messages->all($domain)), // Index max table length
7070
0 // Index attributes
7171
);
7272

@@ -84,7 +84,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
8484

8585
private function writePadding($data)
8686
{
87-
$padding = strlen($data) % 4;
87+
$padding = \strlen($data) % 4;
8888

8989
if ($padding) {
9090
return str_repeat("\xAA", 4 - $padding);
@@ -93,7 +93,7 @@ private function writePadding($data)
9393

9494
private function getPosition($data)
9595
{
96-
return (strlen($data) + 28) / 4;
96+
return (\strlen($data) + 28) / 4;
9797
}
9898

9999
/**

Dumper/JsonFileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
2828
if (isset($options['json_encoding'])) {
2929
$flags = $options['json_encoding'];
3030
} else {
31-
$flags = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0;
31+
$flags = \defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0;
3232
}
3333

3434
return json_encode($messages->all($domain), $flags);

Dumper/MoFileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
4747
'offsetHashes' => MoFileLoader::MO_HEADER_SIZE + (16 * $size),
4848
);
4949

50-
$sourcesSize = strlen($sources);
50+
$sourcesSize = \strlen($sources);
5151
$sourcesStart = $header['offsetHashes'] + 1;
5252

5353
foreach ($offsets as $offset) {

Dumper/XliffFileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,6 @@ private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain,
195195
*/
196196
private function hasMetadataArrayInfo($key, $metadata = null)
197197
{
198-
return null !== $metadata && array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || is_array($metadata[$key]));
198+
return null !== $metadata && array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || \is_array($metadata[$key]));
199199
}
200200
}

0 commit comments

Comments
 (0)