diff --git a/Command/CheckMissingCommand.php b/Command/CheckMissingCommand.php
index e4b7faae..1325897c 100644
--- a/Command/CheckMissingCommand.php
+++ b/Command/CheckMissingCommand.php
@@ -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;
}
@@ -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;
diff --git a/Command/DeleteEmptyCommand.php b/Command/DeleteEmptyCommand.php
index dd4bc231..c61523e6 100644
--- a/Command/DeleteEmptyCommand.php
+++ b/Command/DeleteEmptyCommand.php
@@ -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;
}
@@ -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 "%s" from domain "%s" and locale "%s"',
$message->getKey(),
$message->getDomain(),
diff --git a/Command/DeleteObsoleteCommand.php b/Command/DeleteObsoleteCommand.php
index c0ecc0c1..b3cd57a8 100644
--- a/Command/DeleteObsoleteCommand.php
+++ b/Command/DeleteObsoleteCommand.php
@@ -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;
}
@@ -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 "%s" from domain "%s" and locale "%s"',
$message->getKey(),
$message->getDomain(),
diff --git a/Command/ExtractCommand.php b/Command/ExtractCommand.php
index 488b58fa..e7b3b858 100644
--- a/Command/ExtractCommand.php
+++ b/Command/ExtractCommand.php
@@ -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())
);
}
}
diff --git a/Command/StorageTrait.php b/Command/StorageTrait.php
index fef48bbf..678e1603 100644
--- a/Command/StorageTrait.php
+++ b/Command/StorageTrait.php
@@ -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;
diff --git a/Command/SyncCommand.php b/Command/SyncCommand.php
index 3da5af34..193da8a8 100644
--- a/Command/SyncCommand.php
+++ b/Command/SyncCommand.php
@@ -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;
}
diff --git a/Controller/SymfonyProfilerController.php b/Controller/SymfonyProfilerController.php
index 8461ed7e..41a54e90 100644
--- a/Controller/SymfonyProfilerController.php
+++ b/Controller/SymfonyProfilerController.php
@@ -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
@@ -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]);
@@ -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()))
;
}
diff --git a/Controller/WebUIController.php b/Controller/WebUIController.php
index 2ce6de07..493ef64f 100644
--- a/Controller/WebUIController.php
+++ b/Controller/WebUIController.php
@@ -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);
}
diff --git a/DependencyInjection/CompilerPass/StoragePass.php b/DependencyInjection/CompilerPass/StoragePass.php
index 3e2b6034..ac448b6d 100644
--- a/DependencyInjection/CompilerPass/StoragePass.php
+++ b/DependencyInjection/CompilerPass/StoragePass.php
@@ -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']));
}
}
}
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 95be8ca1..8fd7f064 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -117,7 +117,7 @@ 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]);
@@ -125,7 +125,7 @@ private function configsNode(ArrayNodeDefinition $root): void
}
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;
diff --git a/DependencyInjection/TranslationExtension.php b/DependencyInjection/TranslationExtension.php
index 2f1b1774..1ba8fede 100644
--- a/DependencyInjection/TranslationExtension.php
+++ b/DependencyInjection/TranslationExtension.php
@@ -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']);
diff --git a/EventListener/EditInPlaceResponseListener.php b/EventListener/EditInPlaceResponseListener.php
index 37a6ea52..02583ee0 100644
--- a/EventListener/EditInPlaceResponseListener.php
+++ b/EventListener/EditInPlaceResponseListener.php
@@ -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'),
diff --git a/Service/CacheClearer.php b/Service/CacheClearer.php
index 869ad637..9b5b44ef 100644
--- a/Service/CacheClearer.php
+++ b/Service/CacheClearer.php
@@ -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();
diff --git a/Service/ConfigurationManager.php b/Service/ConfigurationManager.php
index 5a689461..977ae135 100644
--- a/Service/ConfigurationManager.php
+++ b/Service/ConfigurationManager.php
@@ -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
diff --git a/Service/Importer.php b/Service/Importer.php
index 530ca8a7..ef0ec477 100644
--- a/Service/Importer.php
+++ b/Service/Importer.php
@@ -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']);
}
diff --git a/Service/StorageService.php b/Service/StorageService.php
index 3dfc1dd3..88f797bb 100644
--- a/Service/StorageService.php
+++ b/Service/StorageService.php
@@ -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));
}
}
diff --git a/Translator/EditInPlaceTranslator.php b/Translator/EditInPlaceTranslator.php
index 5c2c1dd8..6123a4c8 100644
--- a/Translator/EditInPlaceTranslator.php
+++ b/Translator/EditInPlaceTranslator.php
@@ -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();
@@ -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('%s',
+ return \sprintf('%s',
$domain,
$id,
htmlspecialchars($original),
diff --git a/Translator/FallbackTranslator.php b/Translator/FallbackTranslator.php
index cee1d93a..57ffa223 100644
--- a/Translator/FallbackTranslator.php
+++ b/Translator/FallbackTranslator.php
@@ -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();
diff --git a/Twig/Node/Transchoice.php b/Twig/Node/Transchoice.php
index 1212a94d..d1e67753 100644
--- a/Twig/Node/Transchoice.php
+++ b/Twig/Node/Transchoice.php
@@ -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'