Skip to content

Commit aa24389

Browse files
Merge branch '3.4' into 4.0
* 3.4: 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 9280af9 + 41ab1ff commit aa24389

26 files changed

+56
-56
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
/**

Dumper/FileDumper.php

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

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: 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
}

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)