Skip to content

Commit 84a7765

Browse files
CS fixes
1 parent de8afa5 commit 84a7765

Some content is hidden

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

41 files changed

+96
-96
lines changed

Catalogue/AbstractOperation.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function getDomains(): array
9797
public function getMessages(string $domain): array
9898
{
9999
if (!\in_array($domain, $this->getDomains())) {
100-
throw new InvalidArgumentException(sprintf('Invalid domain: "%s".', $domain));
100+
throw new InvalidArgumentException(\sprintf('Invalid domain: "%s".', $domain));
101101
}
102102

103103
if (!isset($this->messages[$domain][self::ALL_BATCH])) {
@@ -110,7 +110,7 @@ public function getMessages(string $domain): array
110110
public function getNewMessages(string $domain): array
111111
{
112112
if (!\in_array($domain, $this->getDomains())) {
113-
throw new InvalidArgumentException(sprintf('Invalid domain: "%s".', $domain));
113+
throw new InvalidArgumentException(\sprintf('Invalid domain: "%s".', $domain));
114114
}
115115

116116
if (!isset($this->messages[$domain][self::NEW_BATCH])) {
@@ -123,7 +123,7 @@ public function getNewMessages(string $domain): array
123123
public function getObsoleteMessages(string $domain): array
124124
{
125125
if (!\in_array($domain, $this->getDomains())) {
126-
throw new InvalidArgumentException(sprintf('Invalid domain: "%s".', $domain));
126+
throw new InvalidArgumentException(\sprintf('Invalid domain: "%s".', $domain));
127127
}
128128

129129
if (!isset($this->messages[$domain][self::OBSOLETE_BATCH])) {
@@ -160,7 +160,7 @@ public function moveMessagesToIntlDomainsIfPossible(string $batch = self::ALL_BA
160160
self::OBSOLETE_BATCH => $this->getObsoleteMessages($domain),
161161
self::NEW_BATCH => $this->getNewMessages($domain),
162162
self::ALL_BATCH => $this->getMessages($domain),
163-
default => throw new \InvalidArgumentException(sprintf('$batch argument must be one of ["%s", "%s", "%s"].', self::ALL_BATCH, self::NEW_BATCH, self::OBSOLETE_BATCH)),
163+
default => throw new \InvalidArgumentException(\sprintf('$batch argument must be one of ["%s", "%s", "%s"].', self::ALL_BATCH, self::NEW_BATCH, self::OBSOLETE_BATCH)),
164164
};
165165

166166
if (!$messages || (!$this->source->all($intlDomain) && $this->source->all($domain))) {

Command/TranslationPullCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
163163
$this->writer->write($operation->getResult(), $format, $writeOptions);
164164
}
165165

166-
$io->success(sprintf('Local translations has been updated from "%s" (for "%s" locale(s), and "%s" domain(s)).', parse_url($provider, \PHP_URL_SCHEME), implode(', ', $locales), implode(', ', $domains)));
166+
$io->success(\sprintf('Local translations has been updated from "%s" (for "%s" locale(s), and "%s" domain(s)).', parse_url($provider, \PHP_URL_SCHEME), implode(', ', $locales), implode(', ', $domains)));
167167

168168
return 0;
169169
}
@@ -177,7 +177,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
177177
$this->writer->write($catalogue, $format, $writeOptions);
178178
}
179179

180-
$io->success(sprintf('New translations from "%s" has been written locally (for "%s" locale(s), and "%s" domain(s)).', parse_url($provider, \PHP_URL_SCHEME), implode(', ', $locales), implode(', ', $domains)));
180+
$io->success(\sprintf('New translations from "%s" has been written locally (for "%s" locale(s), and "%s" domain(s)).', parse_url($provider, \PHP_URL_SCHEME), implode(', ', $locales), implode(', ', $domains)));
181181

182182
return 0;
183183
}

Command/TranslationPushCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
115115
$provider = $this->providers->get($input->getArgument('provider'));
116116

117117
if (!$this->enabledLocales) {
118-
throw new InvalidArgumentException(sprintf('You must define "framework.enabled_locales" or "framework.translator.providers.%s.locales" config key in order to work with translation providers.', parse_url($provider, \PHP_URL_SCHEME)));
118+
throw new InvalidArgumentException(\sprintf('You must define "framework.enabled_locales" or "framework.translator.providers.%s.locales" config key in order to work with translation providers.', parse_url($provider, \PHP_URL_SCHEME)));
119119
}
120120

121121
$io = new SymfonyStyle($input, $output);
@@ -139,7 +139,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
139139
if (!$deleteMissing && $force) {
140140
$provider->write($localTranslations);
141141

142-
$io->success(sprintf('All local translations has been sent to "%s" (for "%s" locale(s), and "%s" domain(s)).', parse_url($provider, \PHP_URL_SCHEME), implode(', ', $locales), implode(', ', $domains)));
142+
$io->success(\sprintf('All local translations has been sent to "%s" (for "%s" locale(s), and "%s" domain(s)).', parse_url($provider, \PHP_URL_SCHEME), implode(', ', $locales), implode(', ', $domains)));
143143

144144
return 0;
145145
}
@@ -149,7 +149,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
149149
if ($deleteMissing) {
150150
$provider->delete($providerTranslations->diff($localTranslations));
151151

152-
$io->success(sprintf('Missing translations on "%s" has been deleted (for "%s" locale(s), and "%s" domain(s)).', parse_url($provider, \PHP_URL_SCHEME), implode(', ', $locales), implode(', ', $domains)));
152+
$io->success(\sprintf('Missing translations on "%s" has been deleted (for "%s" locale(s), and "%s" domain(s)).', parse_url($provider, \PHP_URL_SCHEME), implode(', ', $locales), implode(', ', $domains)));
153153

154154
// Read provider translations again, after missing translations deletion,
155155
// to avoid push freshly deleted translations.
@@ -164,7 +164,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
164164

165165
$provider->write($translationsToWrite);
166166

167-
$io->success(sprintf('%s local translations has been sent to "%s" (for "%s" locale(s), and "%s" domain(s)).', $force ? 'All' : 'New', parse_url($provider, \PHP_URL_SCHEME), implode(', ', $locales), implode(', ', $domains)));
167+
$io->success(\sprintf('%s local translations has been sent to "%s" (for "%s" locale(s), and "%s" domain(s)).', $force ? 'All' : 'New', parse_url($provider, \PHP_URL_SCHEME), implode(', ', $locales), implode(', ', $domains)));
168168

169169
return 0;
170170
}

Command/XliffLintCommand.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected function configure()
5757
{
5858
$this
5959
->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN')
60-
->addOption('format', null, InputOption::VALUE_REQUIRED, sprintf('The output format ("%s")', implode('", "', $this->getAvailableFormatOptions())))
60+
->addOption('format', null, InputOption::VALUE_REQUIRED, \sprintf('The output format ("%s")', implode('", "', $this->getAvailableFormatOptions())))
6161
->setHelp(<<<EOF
6262
The <info>%command.name%</info> command lints an XLIFF file and outputs to STDOUT
6363
the first encountered syntax error.
@@ -98,7 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9898
$filesInfo = [];
9999
foreach ($filenames as $filename) {
100100
if (!$this->isReadable($filename)) {
101-
throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
101+
throw new RuntimeException(\sprintf('File or directory "%s" is not readable.', $filename));
102102
}
103103

104104
foreach ($this->getFiles($filename) as $file) {
@@ -124,18 +124,18 @@ private function validate(string $content, ?string $file = null): array
124124
$document->loadXML($content);
125125

126126
if (null !== $targetLanguage = $this->getTargetLanguageFromFile($document)) {
127-
$normalizedLocalePattern = sprintf('(%s|%s)', preg_quote($targetLanguage, '/'), preg_quote(str_replace('-', '_', $targetLanguage), '/'));
127+
$normalizedLocalePattern = \sprintf('(%s|%s)', preg_quote($targetLanguage, '/'), preg_quote(str_replace('-', '_', $targetLanguage), '/'));
128128
// strict file names require translation files to be named '____.locale.xlf'
129129
// otherwise, both '____.locale.xlf' and 'locale.____.xlf' are allowed
130130
// also, the regexp matching must be case-insensitive, as defined for 'target-language' values
131131
// http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#target-language
132-
$expectedFilenamePattern = $this->requireStrictFileNames ? sprintf('/^.*\.(?i:%s)\.(?:xlf|xliff)/', $normalizedLocalePattern) : sprintf('/^(?:.*\.(?i:%s)|(?i:%s)\..*)\.(?:xlf|xliff)/', $normalizedLocalePattern, $normalizedLocalePattern);
132+
$expectedFilenamePattern = $this->requireStrictFileNames ? \sprintf('/^.*\.(?i:%s)\.(?:xlf|xliff)/', $normalizedLocalePattern) : \sprintf('/^(?:.*\.(?i:%s)|(?i:%s)\..*)\.(?:xlf|xliff)/', $normalizedLocalePattern, $normalizedLocalePattern);
133133

134134
if (0 === preg_match($expectedFilenamePattern, basename($file))) {
135135
$errors[] = [
136136
'line' => -1,
137137
'column' => -1,
138-
'message' => sprintf('There is a mismatch between the language included in the file name ("%s") and the "%s" value used in the "target-language" attribute of the file.', basename($file), $targetLanguage),
138+
'message' => \sprintf('There is a mismatch between the language included in the file name ("%s") and the "%s" value used in the "target-language" attribute of the file.', basename($file), $targetLanguage),
139139
];
140140
}
141141
}
@@ -160,7 +160,7 @@ private function display(SymfonyStyle $io, array $files): int
160160
'txt' => $this->displayTxt($io, $files),
161161
'json' => $this->displayJson($io, $files),
162162
'github' => $this->displayTxt($io, $files, true),
163-
default => throw new InvalidArgumentException(sprintf('Supported formats are "%s".', implode('", "', $this->getAvailableFormatOptions()))),
163+
default => throw new InvalidArgumentException(\sprintf('Supported formats are "%s".', implode('", "', $this->getAvailableFormatOptions()))),
164164
};
165165
}
166166

@@ -172,25 +172,25 @@ private function displayTxt(SymfonyStyle $io, array $filesInfo, bool $errorAsGit
172172

173173
foreach ($filesInfo as $info) {
174174
if ($info['valid'] && $this->displayCorrectFiles) {
175-
$io->comment('<info>OK</info>'.($info['file'] ? sprintf(' in %s', $info['file']) : ''));
175+
$io->comment('<info>OK</info>'.($info['file'] ? \sprintf(' in %s', $info['file']) : ''));
176176
} elseif (!$info['valid']) {
177177
++$erroredFiles;
178-
$io->text('<error> ERROR </error>'.($info['file'] ? sprintf(' in %s', $info['file']) : ''));
178+
$io->text('<error> ERROR </error>'.($info['file'] ? \sprintf(' in %s', $info['file']) : ''));
179179
$io->listing(array_map(function ($error) use ($info, $githubReporter) {
180180
// general document errors have a '-1' line number
181181
$line = -1 === $error['line'] ? null : $error['line'];
182182

183183
$githubReporter?->error($error['message'], $info['file'], $line, null !== $line ? $error['column'] : null);
184184

185-
return null === $line ? $error['message'] : sprintf('Line %d, Column %d: %s', $line, $error['column'], $error['message']);
185+
return null === $line ? $error['message'] : \sprintf('Line %d, Column %d: %s', $line, $error['column'], $error['message']);
186186
}, $info['messages']));
187187
}
188188
}
189189

190190
if (0 === $erroredFiles) {
191-
$io->success(sprintf('All %d XLIFF files contain valid syntax.', $countFiles));
191+
$io->success(\sprintf('All %d XLIFF files contain valid syntax.', $countFiles));
192192
} else {
193-
$io->warning(sprintf('%d XLIFF files have valid syntax and %d contain errors.', $countFiles - $erroredFiles, $erroredFiles));
193+
$io->warning(\sprintf('%d XLIFF files have valid syntax and %d contain errors.', $countFiles - $erroredFiles, $erroredFiles));
194194
}
195195

196196
return min($erroredFiles, 1);

DataCollectorTranslator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter
3434
public function __construct(TranslatorInterface $translator)
3535
{
3636
if (!$translator instanceof TranslatorBagInterface || !$translator instanceof LocaleAwareInterface) {
37-
throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface, TranslatorBagInterface and LocaleAwareInterface.', get_debug_type($translator)));
37+
throw new InvalidArgumentException(\sprintf('The Translator "%s" must implement TranslatorInterface, TranslatorBagInterface and LocaleAwareInterface.', get_debug_type($translator)));
3838
}
3939

4040
$this->translator = $translator;

DependencyInjection/LoggingTranslatorPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function process(ContainerBuilder $container): void
3737
$class = $container->getParameterBag()->resolveValue($definition->getClass());
3838

3939
if (!$r = $container->getReflectionClass($class)) {
40-
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $translatorAlias));
40+
throw new InvalidArgumentException(\sprintf('Class "%s" used for service "%s" cannot be found.', $class, $translatorAlias));
4141
}
4242

4343
if (!$r->isSubclassOf(TranslatorInterface::class) || !$r->isSubclassOf(TranslatorBagInterface::class)) {

DependencyInjection/TranslationExtractorPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function process(ContainerBuilder $container)
3434

3535
foreach ($container->findTaggedServiceIds('translation.extractor', true) as $id => $attributes) {
3636
if (!isset($attributes[0]['alias'])) {
37-
throw new RuntimeException(sprintf('The alias for the tag "translation.extractor" of service "%s" must be set.', $id));
37+
throw new RuntimeException(\sprintf('The alias for the tag "translation.extractor" of service "%s" must be set.', $id));
3838
}
3939

4040
$definition->addMethodCall('addExtractor', [$attributes[0]['alias'], new Reference($id)]);

Dumper/FileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function dump(MessageCatalogue $messages, array $options = [])
5757
if (!file_exists($fullpath)) {
5858
$directory = \dirname($fullpath);
5959
if (!file_exists($directory) && !@mkdir($directory, 0777, true)) {
60-
throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory));
60+
throw new RuntimeException(\sprintf('Unable to create directory "%s".', $directory));
6161
}
6262
}
6363

Dumper/PoFileDumper.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ public function formatCatalogue(MessageCatalogue $messages, string $domain, arra
5151
$sourceRules = $this->getStandardRules($source);
5252
$targetRules = $this->getStandardRules($target);
5353
if (2 == \count($sourceRules) && [] !== $targetRules) {
54-
$output .= sprintf('msgid "%s"'."\n", $this->escape($sourceRules[0]));
55-
$output .= sprintf('msgid_plural "%s"'."\n", $this->escape($sourceRules[1]));
54+
$output .= \sprintf('msgid "%s"'."\n", $this->escape($sourceRules[0]));
55+
$output .= \sprintf('msgid_plural "%s"'."\n", $this->escape($sourceRules[1]));
5656
foreach ($targetRules as $i => $targetRule) {
57-
$output .= sprintf('msgstr[%d] "%s"'."\n", $i, $this->escape($targetRule));
57+
$output .= \sprintf('msgstr[%d] "%s"'."\n", $i, $this->escape($targetRule));
5858
}
5959
} else {
60-
$output .= sprintf('msgid "%s"'."\n", $this->escape($source));
61-
$output .= sprintf('msgstr "%s"'."\n", $this->escape($target));
60+
$output .= \sprintf('msgid "%s"'."\n", $this->escape($source));
61+
$output .= \sprintf('msgstr "%s"'."\n", $this->escape($target));
6262
}
6363
}
6464

@@ -123,7 +123,7 @@ private function formatComments(string|array $comments, string $prefix = ''): ?s
123123
$output = null;
124124

125125
foreach ((array) $comments as $comment) {
126-
$output .= sprintf('#%s %s'."\n", $prefix, $comment);
126+
$output .= \sprintf('#%s %s'."\n", $prefix, $comment);
127127
}
128128

129129
return $output;

Dumper/XliffFileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function formatCatalogue(MessageCatalogue $messages, string $domain, arra
4646
return $this->dumpXliff2($defaultLocale, $messages, $domain);
4747
}
4848

49-
throw new InvalidArgumentException(sprintf('No support implemented for dumping XLIFF version "%s".', $xliffVersion));
49+
throw new InvalidArgumentException(\sprintf('No support implemented for dumping XLIFF version "%s".', $xliffVersion));
5050
}
5151

5252
protected function getExtension(): string

0 commit comments

Comments
 (0)