Skip to content

Commit e06d236

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 2dd74d6 + aa24389 commit e06d236

26 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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private function validate($content, $file = null)
139139
libxml_clear_errors();
140140
libxml_use_internal_errors(false);
141141

142-
return array('file' => $file, 'valid' => 0 === count($errors), 'messages' => $errors);
142+
return array('file' => $file, 'valid' => 0 === \count($errors), 'messages' => $errors);
143143
}
144144

145145
private function display(SymfonyStyle $io, array $files)
@@ -156,7 +156,7 @@ private function display(SymfonyStyle $io, array $files)
156156

157157
private function displayTxt(SymfonyStyle $io, array $filesInfo)
158158
{
159-
$countFiles = count($filesInfo);
159+
$countFiles = \count($filesInfo);
160160
$erroredFiles = 0;
161161

162162
foreach ($filesInfo as $info) {
@@ -206,7 +206,7 @@ private function getFiles($fileOrDirectory)
206206
}
207207

208208
foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) {
209-
if (!in_array($file->getExtension(), array('xlf', 'xliff'))) {
209+
if (!\in_array($file->getExtension(), array('xlf', 'xliff'))) {
210210
continue;
211211
}
212212

@@ -238,7 +238,7 @@ private function getDirectoryIterator($directory)
238238
};
239239

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

244244
return $default($directory);
@@ -251,7 +251,7 @@ private function isReadable($fileOrDirectory)
251251
};
252252

253253
if (null !== $this->isReadableProvider) {
254-
return call_user_func($this->isReadableProvider, $fileOrDirectory, $default);
254+
return \call_user_func($this->isReadableProvider, $fileOrDirectory, $default);
255255
}
256256

257257
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
/**

Dumper/FileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function dump(MessageCatalogue $messages, $options = array())
7171
foreach ($messages->getDomains() as $domain) {
7272
$fullpath = $options['path'].'/'.$this->getRelativePath($domain, $messages->getLocale());
7373
if (!file_exists($fullpath)) {
74-
$directory = dirname($fullpath);
74+
$directory = \dirname($fullpath);
7575
if (!file_exists($directory) && !@mkdir($directory, 0777, true)) {
7676
throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory));
7777
}

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/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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain,
147147
$translation = $dom->createElement('unit');
148148
$translation->setAttribute('id', strtr(substr(base64_encode(hash('sha256', $source, true)), 0, 7), '/+', '._'));
149149
$name = $source;
150-
if (strlen($source) > 80) {
150+
if (\strlen($source) > 80) {
151151
$name = substr(md5($source), -7);
152152
}
153153
$translation->setAttribute('name', $name);
@@ -200,6 +200,6 @@ private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain,
200200
*/
201201
private function hasMetadataArrayInfo($key, $metadata = null)
202202
{
203-
return null !== $metadata && array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || is_array($metadata[$key]));
203+
return null !== $metadata && array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || \is_array($metadata[$key]));
204204
}
205205
}

Extractor/AbstractFileExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ abstract class AbstractFileExtractor
2727
*/
2828
protected function extractFiles($resource)
2929
{
30-
if (is_array($resource) || $resource instanceof \Traversable) {
30+
if (\is_array($resource) || $resource instanceof \Traversable) {
3131
$files = array();
3232
foreach ($resource as $file) {
3333
if ($this->canBeExtracted($file)) {

Extractor/PhpExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ protected function parseTokens($tokens, MessageCatalogue $catalog)
208208
} elseif (self::MESSAGE_TOKEN === $item) {
209209
$message = $this->getValue($tokenIterator);
210210

211-
if (count($sequence) === ($sequenceKey + 1)) {
211+
if (\count($sequence) === ($sequenceKey + 1)) {
212212
break;
213213
}
214214
} elseif (self::METHOD_ARGUMENTS_TOKEN === $item) {

0 commit comments

Comments
 (0)