Skip to content

Fix CS w/ PHP CS Fixer #510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Command/CheckMissingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io = new SymfonyStyle($input, $output);

if ($newMessages > 0) {
$io->error(sprintf('%d new message(s) have been found, run bin/console translation:extract', $newMessages));
$io->error(\sprintf('%d new message(s) have been found, run bin/console translation:extract', $newMessages));

return 1;
}
Expand All @@ -102,7 +102,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

if ($emptyTranslations > 0) {
$io->error(
sprintf('%d messages have empty translations, please provide translations for them', $emptyTranslations)
\sprintf('%d messages have empty translations, please provide translations for them', $emptyTranslations)
);

return 1;
Expand Down
4 changes: 2 additions & 2 deletions Command/DeleteEmptyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($input->isInteractive()) {
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion(sprintf('You are about to remove %d translations. Do you wish to continue? (y/N) ', $messageCount), false);
$question = new ConfirmationQuestion(\sprintf('You are about to remove %d translations. Do you wish to continue? (y/N) ', $messageCount), false);
if (!$helper->ask($input, $output, $question)) {
return 0;
}
Expand All @@ -112,7 +112,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
foreach ($messages as $message) {
$storage->delete($message->getLocale(), $message->getDomain(), $message->getKey());
if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
$output->writeln(sprintf(
$output->writeln(\sprintf(
'Deleted empty message "<info>%s</info>" from domain "<info>%s</info>" and locale "<info>%s</info>"',
$message->getKey(),
$message->getDomain(),
Expand Down
4 changes: 2 additions & 2 deletions Command/DeleteObsoleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($input->isInteractive()) {
/** @var QuestionHelper $helper */
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion(sprintf('You are about to remove %d translations. Do you wish to continue? (y/N) ', $messageCount), false);
$question = new ConfirmationQuestion(\sprintf('You are about to remove %d translations. Do you wish to continue? (y/N) ', $messageCount), false);
if (!$helper->ask($input, $output, $question)) {
return 0;
}
Expand All @@ -113,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
foreach ($messages as $message) {
$storage->delete($message->getLocale(), $message->getDomain(), $message->getKey());
if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
$output->writeln(sprintf(
$output->writeln(\sprintf(
'Deleted obsolete message "<info>%s</info>" from domain "<info>%s</info>" and locale "<info>%s</info>"',
$message->getKey(),
$message->getDomain(),
Expand Down
2 changes: 1 addition & 1 deletion Command/ExtractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
/** @var Error $error */
foreach ($errors as $error) {
$io->error(
sprintf("%s\nLine: %s\nMessage: %s", $error->getPath(), $error->getLine(), $error->getMessage())
\sprintf("%s\nLine: %s\nMessage: %s", $error->getPath(), $error->getLine(), $error->getMessage())
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Command/StorageTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private function getStorage($configName): StorageService
if (null === $storage = $this->storageManager->getStorage($configName)) {
$availableStorages = $this->storageManager->getNames();

throw new \InvalidArgumentException(sprintf('Unknown storage "%s". Available storages are "%s".', $configName, implode('", "', $availableStorages)));
throw new \InvalidArgumentException(\sprintf('Unknown storage "%s". Available storages are "%s".', $configName, implode('", "', $availableStorages)));
}

return $storage;
Expand Down
2 changes: 1 addition & 1 deletion Command/SyncCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int

break;
default:
$output->writeln(sprintf('Direction must be either "up" or "down". Not "%s".', $input->getArgument('direction')));
$output->writeln(\sprintf('Direction must be either "up" or "down". Not "%s".', $input->getArgument('direction')));

return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions Controller/SymfonyProfilerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function createAssetsAction(Request $request, string $token): Response
$uploaded[] = $message;
}

return new Response(sprintf('%s new assets created!', \count($uploaded)));
return new Response(\sprintf('%s new assets created!', \count($uploaded)));
}

private function getMessage(Request $request, string $token): SfProfilerMessage
Expand All @@ -142,7 +142,7 @@ private function getMessage(Request $request, string $token): SfProfilerMessage
$collectorMessages = $this->getMessages($token);

if (!isset($collectorMessages[$messageId])) {
throw new NotFoundHttpException(sprintf('No message with key "%s" was found.', $messageId));
throw new NotFoundHttpException(\sprintf('No message with key "%s" was found.', $messageId));
}
$message = SfProfilerMessage::create($collectorMessages[$messageId]);

Expand All @@ -152,7 +152,7 @@ private function getMessage(Request $request, string $token): SfProfilerMessage

$message
->setLocale($requestCollector->getLocale())
->setTranslation(sprintf('[%s]', $message->getTranslation()))
->setTranslation(\sprintf('[%s]', $message->getTranslation()))
;
}

Expand Down
2 changes: 1 addition & 1 deletion Controller/WebUIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function createAction(Request $request, string $configName, string $local
try {
$storage->create($message);
} catch (StorageException $e) {
throw new BadRequestHttpException(sprintf('Key "%s" does already exist for "%s" on domain "%s".', $message->getKey(), $locale, $domain), $e);
throw new BadRequestHttpException(\sprintf('Key "%s" does already exist for "%s" on domain "%s".', $message->getKey(), $locale, $domain), $e);
} catch (\Exception $e) {
return new Response($e->getMessage(), Response::HTTP_BAD_REQUEST);
}
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/CompilerPass/StoragePass.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function process(ContainerBuilder $container): void

break;
default:
throw new \LogicException(sprintf('The tag "php_translation.storage" must have a "type" of value "local" or "remote". Value "%s" was provided', $tag['type']));
throw new \LogicException(\sprintf('The tag "php_translation.storage" must have a "type" of value "local" or "remote". Value "%s" was provided', $tag['type']));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ private function configsNode(ArrayNodeDefinition $root): void

$bundles = $container->getParameter('kernel.bundles');
if (!isset($bundles[$bundleName])) {
throw new \Exception(sprintf('The bundle "%s" does not exist. Available bundles: %s', $bundleName, array_keys($bundles)));
throw new \Exception(\sprintf('The bundle "%s" does not exist. Available bundles: %s', $bundleName, array_keys($bundles)));
}

$ref = new \ReflectionClass($bundles[$bundleName]);
$value = false === $pos ? \dirname($ref->getFileName()) : \dirname($ref->getFileName()).substr($value, $pos);
}

if (!is_dir($value)) {
throw new \Exception(sprintf('The directory "%s" does not exist.', $value));
throw new \Exception(\sprintf('The directory "%s" does not exist.', $value));
}

return $value;
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/TranslationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private function enableEditInPlace(ContainerBuilder $container, array $config):
$name = $config['edit_in_place']['config_name'];

if ('default' !== $name && !isset($config['configs'][$name])) {
throw new InvalidArgumentException(sprintf('There is no config named "%s".', $name));
throw new InvalidArgumentException(\sprintf('There is no config named "%s".', $name));
}

$activatorRef = new Reference($config['edit_in_place']['activator']);
Expand Down
2 changes: 1 addition & 1 deletion EventListener/EditInPlaceResponseListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function onKernelResponse(ResponseEvent $event): void
}
$content = preg_replace($pattern, $replacement, $content);

$html = sprintf(
$html = \sprintf(
self::HTML,
$this->packages->getUrl('bundles/translation/css/content-tools.min.css'),
$this->packages->getUrl('bundles/translation/js/content-tools.min.js'),
Expand Down
2 changes: 1 addition & 1 deletion Service/CacheClearer.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function __construct(string $kernelCacheDir, $translator, Filesystem $fil
*/
public function clearAndWarmUp(?string $locale = null): void
{
$translationDir = sprintf('%s/translations', $this->kernelCacheDir);
$translationDir = \sprintf('%s/translations', $this->kernelCacheDir);

$finder = new Finder();

Expand Down
2 changes: 1 addition & 1 deletion Service/ConfigurationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getConfiguration($name = null): Configuration
}
}

throw new \InvalidArgumentException(sprintf('No configuration found for "%s"', $name));
throw new \InvalidArgumentException(\sprintf('No configuration found for "%s"', $name));
}

public function getFirstName(): ?string
Expand Down
2 changes: 1 addition & 1 deletion Service/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private function convertSourceLocationsToMessages(
$trimLength = 1 + \strlen($this->config['project_root']);

$meta = $this->getMetadata($catalogue, $key, $messageDomain);
$meta->addCategory('file-source', sprintf('%s:%s', substr($sourceLocation->getPath(), $trimLength), $sourceLocation->getLine()));
$meta->addCategory('file-source', \sprintf('%s:%s', substr($sourceLocation->getPath(), $trimLength), $sourceLocation->getLine()));
if (isset($sourceLocation->getContext()['desc'])) {
$meta->addCategory('desc', $sourceLocation->getContext()['desc']);
}
Expand Down
2 changes: 1 addition & 1 deletion Service/StorageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function sync(string $direction = self::DIRECTION_DOWN, array $importOpti

break;
default:
throw new LogicException(sprintf('Direction must be either "up" or "down". Value "%s" was provided', $direction));
throw new LogicException(\sprintf('Direction must be either "up" or "down". Value "%s" was provided', $direction));
}
}

Expand Down
4 changes: 2 additions & 2 deletions Translator/EditInPlaceTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function getCatalogue($locale = null): MessageCatalogueInterface
public function getCatalogues(): array
{
if (!method_exists($this->translator, 'getCatalogues')) {
throw new \Exception(sprintf('%s method is not available! Please, upgrade to Symfony 6 in order to to use it', __METHOD__));
throw new \Exception(\sprintf('%s method is not available! Please, upgrade to Symfony 6 in order to to use it', __METHOD__));
}

return $this->translator->getCatalogues();
Expand All @@ -103,7 +103,7 @@ public function trans($id, array $parameters = [], $domain = null, $locale = nul
}

// Render all data in the translation tag required to allow in-line translation
return sprintf('<x-trans data-key="%s|%s" data-value="%s" data-plain="%s" data-domain="%s" data-locale="%s">%s</x-trans>',
return \sprintf('<x-trans data-key="%s|%s" data-value="%s" data-plain="%s" data-domain="%s" data-locale="%s">%s</x-trans>',
$domain,
$id,
htmlspecialchars($original),
Expand Down
2 changes: 1 addition & 1 deletion Translator/FallbackTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function getCatalogue($locale = null): MessageCatalogueInterface
public function getCatalogues(): array
{
if (!method_exists($this->symfonyTranslator, 'getCatalogues')) {
throw new \Exception(sprintf('%s method is not available! Please, upgrade to Symfony 6 in order to to use it', __METHOD__));
throw new \Exception(\sprintf('%s method is not available! Please, upgrade to Symfony 6 in order to to use it', __METHOD__));
}

return $this->symfonyTranslator->getCatalogues();
Expand Down
2 changes: 1 addition & 1 deletion Twig/Node/Transchoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(ArrayExpression $arguments, $lineno)
public function compile(Compiler $compiler): void
{
$compiler->raw(
sprintf(
\sprintf(
'$this->env->getExtension(\'%s\')->%s(',
'Translation\Bundle\Twig\TranslationExtension',
'transchoiceWithDefault'
Expand Down
Loading