diff --git a/src/Command/CleanDownloadedImagesCommand.php b/src/Command/CleanDownloadedImagesCommand.php
index c1122dd95..ee1415c5c 100644
--- a/src/Command/CleanDownloadedImagesCommand.php
+++ b/src/Command/CleanDownloadedImagesCommand.php
@@ -65,7 +65,7 @@ class CleanDownloadedImagesCommand extends Command
$existingPaths[] = $file->getFilename();
}
- $io->text(sprintf(' -> %d images found', \count($existingPaths)));
+ $io->text(\sprintf(' -> %d images found', \count($existingPaths)));
$io->text('Retrieve valid folders attached to a user');
@@ -84,7 +84,7 @@ class CleanDownloadedImagesCommand extends Command
$validPaths[] = explode('/', $path)[2];
}
- $io->text(sprintf(' -> %d folders found', \count($validPaths)));
+ $io->text(\sprintf(' -> %d folders found', \count($validPaths)));
$deletedCount = 0;
@@ -103,11 +103,11 @@ class CleanDownloadedImagesCommand extends Command
$deletedCount += \count($files);
- $io->text(sprintf('Deleted images in %s: %d', $existingPath, \count($files)));
+ $io->text(\sprintf('Deleted images in %s: %d', $existingPath, \count($files)));
}
}
- $io->success(sprintf('Finished cleaning. %d deleted images', $deletedCount));
+ $io->success(\sprintf('Finished cleaning. %d deleted images', $deletedCount));
return 0;
}
diff --git a/src/Command/CleanDuplicatesCommand.php b/src/Command/CleanDuplicatesCommand.php
index 63376a475..2ee306cd3 100644
--- a/src/Command/CleanDuplicatesCommand.php
+++ b/src/Command/CleanDuplicatesCommand.php
@@ -56,7 +56,7 @@ class CleanDuplicatesCommand extends Command
$user = $this->getUser($username);
$this->cleanDuplicates($user);
} catch (NoResultException $e) {
- $this->io->error(sprintf('User "%s" not found.', $username));
+ $this->io->error(\sprintf('User "%s" not found.', $username));
return 1;
}
@@ -65,13 +65,13 @@ class CleanDuplicatesCommand extends Command
} else {
$users = $this->userRepository->findAll();
- $this->io->text(sprintf('Cleaning through %d user accounts', \count($users)));
+ $this->io->text(\sprintf('Cleaning through %d user accounts', \count($users)));
foreach ($users as $user) {
- $this->io->text(sprintf('Processing user %s', $user->getUsername()));
+ $this->io->text(\sprintf('Processing user %s', $user->getUsername()));
$this->cleanDuplicates($user);
}
- $this->io->success(sprintf('Finished cleaning. %d duplicates found in total', $this->duplicates));
+ $this->io->success(\sprintf('Finished cleaning. %d duplicates found in total', $this->duplicates));
}
return 0;
@@ -99,7 +99,7 @@ class CleanDuplicatesCommand extends Command
$this->duplicates += $duplicatesCount;
- $this->io->text(sprintf('Cleaned %d duplicates for user %s', $duplicatesCount, $user->getUserName()));
+ $this->io->text(\sprintf('Cleaned %d duplicates for user %s', $duplicatesCount, $user->getUserName()));
}
private function similarUrl($url)
diff --git a/src/Command/ExportCommand.php b/src/Command/ExportCommand.php
index 498bb1c10..8db47c4e8 100644
--- a/src/Command/ExportCommand.php
+++ b/src/Command/ExportCommand.php
@@ -56,7 +56,7 @@ class ExportCommand extends Command
try {
$user = $this->userRepository->findOneByUserName($input->getArgument('username'));
} catch (NoResultException $e) {
- $io->error(sprintf('User "%s" not found.', $input->getArgument('username')));
+ $io->error(\sprintf('User "%s" not found.', $input->getArgument('username')));
return 1;
}
@@ -66,12 +66,12 @@ class ExportCommand extends Command
->getQuery()
->getResult();
- $io->text(sprintf('Exporting %d entrie(s) for user %s...', \count($entries), $user->getUserName()));
+ $io->text(\sprintf('Exporting %d entrie(s) for user %s...', \count($entries), $user->getUserName()));
$filePath = $input->getArgument('filepath');
if (!$filePath) {
- $filePath = $this->projectDir . '/' . sprintf('%s-export.json', $user->getUsername());
+ $filePath = $this->projectDir . '/' . \sprintf('%s-export.json', $user->getUsername());
}
try {
@@ -82,7 +82,7 @@ class ExportCommand extends Command
->exportJsonData();
file_put_contents($filePath, $data);
} catch (\InvalidArgumentException $e) {
- $io->error(sprintf('Error: "%s"', $e->getMessage()));
+ $io->error(\sprintf('Error: "%s"', $e->getMessage()));
return 1;
}
diff --git a/src/Command/GenerateUrlHashesCommand.php b/src/Command/GenerateUrlHashesCommand.php
index 190b3b75b..9ac7de0f2 100644
--- a/src/Command/GenerateUrlHashesCommand.php
+++ b/src/Command/GenerateUrlHashesCommand.php
@@ -50,17 +50,17 @@ class GenerateUrlHashesCommand extends Command
$user = $this->getUser($username);
$this->generateHashedUrls($user);
} catch (NoResultException $e) {
- $output->writeln(sprintf('User "%s" not found.', $username));
+ $output->writeln(\sprintf('User "%s" not found.', $username));
return 1;
}
} else {
$users = $this->userRepository->findAll();
- $output->writeln(sprintf('Generating hashed urls for "%d" users', \count($users)));
+ $output->writeln(\sprintf('Generating hashed urls for "%d" users', \count($users)));
foreach ($users as $user) {
- $output->writeln(sprintf('Processing user: %s', $user->getUsername()));
+ $output->writeln(\sprintf('Processing user: %s', $user->getUsername()));
$this->generateHashedUrls($user);
}
$output->writeln('Finished generated hashed urls');
@@ -86,7 +86,7 @@ class GenerateUrlHashesCommand extends Command
$this->entityManager->flush();
- $this->output->writeln(sprintf('Generated hashed urls for user: %s', $user->getUserName()));
+ $this->output->writeln(\sprintf('Generated hashed urls for user: %s', $user->getUserName()));
}
/**
diff --git a/src/Command/Import/ImportCommand.php b/src/Command/Import/ImportCommand.php
index a8699a051..4c2594eb0 100644
--- a/src/Command/Import/ImportCommand.php
+++ b/src/Command/Import/ImportCommand.php
@@ -98,7 +98,7 @@ class ImportCommand extends Command
$output->writeln('Start : ' . (new \DateTime())->format('d-m-Y G:i:s') . ' ---');
if (!file_exists($input->getArgument('filepath'))) {
- throw new Exception(sprintf('File "%s" not found', $input->getArgument('filepath')));
+ throw new Exception(\sprintf('File "%s" not found', $input->getArgument('filepath')));
}
// Turning off doctrine default logs queries for saving memory
@@ -115,7 +115,7 @@ class ImportCommand extends Command
}
if (!\is_object($entityUser)) {
- throw new Exception(sprintf('User "%s" not found', $input->getArgument('username')));
+ throw new Exception(\sprintf('User "%s" not found', $input->getArgument('username')));
}
// Authenticate user for paywalled websites
diff --git a/src/Command/Import/RedisWorkerCommand.php b/src/Command/Import/RedisWorkerCommand.php
index 1259778fb..f788f22a2 100644
--- a/src/Command/Import/RedisWorkerCommand.php
+++ b/src/Command/Import/RedisWorkerCommand.php
@@ -41,7 +41,7 @@ class RedisWorkerCommand extends Command
$serviceName = $input->getArgument('serviceName');
if (!$this->container->has('wallabag.queue.redis.' . $serviceName) || !$this->container->has('wallabag.consumer.redis.' . $serviceName)) {
- throw new Exception(sprintf('No queue or consumer found for service name: "%s"', $input->getArgument('serviceName')));
+ throw new Exception(\sprintf('No queue or consumer found for service name: "%s"', $input->getArgument('serviceName')));
}
$worker = new QueueWorker(
diff --git a/src/Command/InstallCommand.php b/src/Command/InstallCommand.php
index 8eb2f4c93..9ef7a3ec0 100644
--- a/src/Command/InstallCommand.php
+++ b/src/Command/InstallCommand.php
@@ -109,7 +109,7 @@ class InstallCommand extends Command
$help = 'Database driver "' . $this->databaseDriver . '" is not installed.';
}
- $rows[] = [sprintf($label, $this->databaseDriver), $status, $help];
+ $rows[] = [\sprintf($label, $this->databaseDriver), $status, $help];
// testing if connection to the database can be established
$label = 'Database connection';
@@ -388,12 +388,12 @@ class InstallCommand extends Command
$schemaManager = $connection->createSchemaManager();
} catch (\Exception $exception) {
// mysql & sqlite
- if (str_contains($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) {
+ if (str_contains($exception->getMessage(), \sprintf("Unknown database '%s'", $databaseName))) {
return false;
}
// pgsql
- if (str_contains($exception->getMessage(), sprintf('database "%s" does not exist', $databaseName))) {
+ if (str_contains($exception->getMessage(), \sprintf('database "%s" does not exist', $databaseName))) {
return false;
}
diff --git a/src/Command/ListUserCommand.php b/src/Command/ListUserCommand.php
index ac44f5115..e31f0ef47 100644
--- a/src/Command/ListUserCommand.php
+++ b/src/Command/ListUserCommand.php
@@ -59,7 +59,7 @@ class ListUserCommand extends Command
$io->table(['username', 'email', 'is enabled?', 'is admin?'], $rows);
$io->success(
- sprintf(
+ \sprintf(
'%s/%s%s user(s) displayed.',
\count($users),
$nbUsers,
diff --git a/src/Command/ReloadEntryCommand.php b/src/Command/ReloadEntryCommand.php
index 3923b1fab..1aebd3a7d 100644
--- a/src/Command/ReloadEntryCommand.php
+++ b/src/Command/ReloadEntryCommand.php
@@ -63,7 +63,7 @@ class ReloadEntryCommand extends Command
->findOneByUserName($username)
->getId();
} catch (NoResultException $e) {
- $io->error(sprintf('User "%s" not found.', $username));
+ $io->error(\sprintf('User "%s" not found.', $username));
return 1;
}
@@ -80,7 +80,7 @@ class ReloadEntryCommand extends Command
}
$io->note(
- sprintf(
+ \sprintf(
"You're going to reload %s entries. Depending on the number of entry to reload, this could be a very long process.",
$nbEntries
)
diff --git a/src/Command/ShowUserCommand.php b/src/Command/ShowUserCommand.php
index 041675e5e..6a341b6c8 100644
--- a/src/Command/ShowUserCommand.php
+++ b/src/Command/ShowUserCommand.php
@@ -47,7 +47,7 @@ class ShowUserCommand extends Command
$user = $this->getUser($username);
$this->showUser($user);
} catch (NoResultException $e) {
- $this->io->error(sprintf('User "%s" not found.', $username));
+ $this->io->error(\sprintf('User "%s" not found.', $username));
return 1;
}
@@ -58,13 +58,13 @@ class ShowUserCommand extends Command
private function showUser(User $user)
{
$this->io->listing([
- sprintf('Username: %s', $user->getUsername()),
- sprintf('Email: %s', $user->getEmail()),
- sprintf('Display name: %s', $user->getName()),
- sprintf('Creation date: %s', $user->getCreatedAt()->format('Y-m-d H:i:s')),
- sprintf('Last login: %s', null !== $user->getLastLogin() ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'),
- sprintf('2FA (email) activated: %s', $user->isEmailTwoFactor() ? 'yes' : 'no'),
- sprintf('2FA (OTP) activated: %s', $user->isGoogleAuthenticatorEnabled() ? 'yes' : 'no'),
+ \sprintf('Username: %s', $user->getUsername()),
+ \sprintf('Email: %s', $user->getEmail()),
+ \sprintf('Display name: %s', $user->getName()),
+ \sprintf('Creation date: %s', $user->getCreatedAt()->format('Y-m-d H:i:s')),
+ \sprintf('Last login: %s', null !== $user->getLastLogin() ? $user->getLastLogin()->format('Y-m-d H:i:s') : 'never'),
+ \sprintf('2FA (email) activated: %s', $user->isEmailTwoFactor() ? 'yes' : 'no'),
+ \sprintf('2FA (OTP) activated: %s', $user->isGoogleAuthenticatorEnabled() ? 'yes' : 'no'),
]);
}
diff --git a/src/Command/TagAllCommand.php b/src/Command/TagAllCommand.php
index 31fa852bd..628858ec5 100644
--- a/src/Command/TagAllCommand.php
+++ b/src/Command/TagAllCommand.php
@@ -49,12 +49,12 @@ class TagAllCommand extends Command
try {
$user = $this->getUser($input->getArgument('username'));
} catch (NoResultException $e) {
- $io->error(sprintf('User "%s" not found.', $input->getArgument('username')));
+ $io->error(\sprintf('User "%s" not found.', $input->getArgument('username')));
return 1;
}
- $io->text(sprintf('Tagging entries for user %s...', $user->getUserName()));
+ $io->text(\sprintf('Tagging entries for user %s...', $user->getUserName()));
$entries = $this->ruleBasedTagger->tagAllForUser($user);
diff --git a/src/Controller/Api/EntryRestController.php b/src/Controller/Api/EntryRestController.php
index b9fcffcd7..4274b1cfb 100644
--- a/src/Controller/Api/EntryRestController.php
+++ b/src/Controller/Api/EntryRestController.php
@@ -1088,7 +1088,7 @@ class EntryRestController extends WallabagRestController
{
$expect = $request->query->get('expect', 'entry');
if (!\in_array($expect, ['id', 'entry'], true)) {
- throw new BadRequestHttpException(sprintf("expect: 'id' or 'entry' expected, %s given", $expect));
+ throw new BadRequestHttpException(\sprintf("expect: 'id' or 'entry' expected, %s given", $expect));
}
$this->validateAuthentication();
$this->validateUserAccess($entry->getUser()->getId());
diff --git a/src/Controller/EntryController.php b/src/Controller/EntryController.php
index 92563b77c..814ba717b 100644
--- a/src/Controller/EntryController.php
+++ b/src/Controller/EntryController.php
@@ -657,7 +657,7 @@ class EntryController extends AbstractController
$qb = $this->entryRepository->getBuilderForAllByUser($this->getUser()->getId());
break;
default:
- throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type));
+ throw new \InvalidArgumentException(\sprintf('Type "%s" is not implemented.', $type));
}
$form = $this->createForm(EntryFilterType::class, [], $formOptions);
diff --git a/src/Controller/FeedController.php b/src/Controller/FeedController.php
index b329f8002..70b9de359 100644
--- a/src/Controller/FeedController.php
+++ b/src/Controller/FeedController.php
@@ -102,7 +102,7 @@ class FeedController extends AbstractController
];
if (!isset($sorts[$sort])) {
- throw new BadRequestHttpException(sprintf('Sort "%s" is not available.', $sort));
+ throw new BadRequestHttpException(\sprintf('Sort "%s" is not available.', $sort));
}
$url = $this->generateUrl(
@@ -200,7 +200,7 @@ class FeedController extends AbstractController
$qb = $this->entryRepository->getBuilderForAllByUser($user->getId());
break;
default:
- throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type));
+ throw new \InvalidArgumentException(\sprintf('Type "%s" is not implemented.', $type));
}
$pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false);
diff --git a/src/Form/Type/EntryFilterType.php b/src/Form/Type/EntryFilterType.php
index cdd8fbc7f..d4462f36d 100644
--- a/src/Form/Type/EntryFilterType.php
+++ b/src/Form/Type/EntryFilterType.php
@@ -114,7 +114,7 @@ class EntryFilterType extends AbstractType
return false;
}
- $paramName = sprintf('%s', str_replace('.', '_', $field));
+ $paramName = \sprintf('%s', str_replace('.', '_', $field));
$expression = $filterQuery->getExpr()->eq($field, ':' . $paramName);
$parameters = [$paramName => $value];
diff --git a/src/Helper/EntriesExport.php b/src/Helper/EntriesExport.php
index 2f8ef4a10..9b4712632 100644
--- a/src/Helper/EntriesExport.php
+++ b/src/Helper/EntriesExport.php
@@ -119,7 +119,7 @@ class EntriesExport
return $this->$functionName();
}
- throw new \InvalidArgumentException(sprintf('The format "%s" is not yet supported.', $format));
+ throw new \InvalidArgumentException(\sprintf('The format "%s" is not yet supported.', $format));
}
public function exportJsonData()
@@ -196,7 +196,7 @@ class EntriesExport
foreach ($entry->getTags() as $tag) {
$book->setSubject($tag->getLabel());
}
- $filename = sha1(sprintf('%s:%s', $entry->getUrl(), $entry->getTitle()));
+ $filename = sha1(\sprintf('%s:%s', $entry->getUrl(), $entry->getTitle()));
$publishedBy = $entry->getPublishedBy();
$authors = $this->translator->trans('export.unknown');
@@ -232,8 +232,8 @@ class EntriesExport
$book->addChapter('Notices', 'Cover2.html', $content_start . $this->getExportInformation('PHPePub') . $bookEnd);
// Could also be the ISBN number, prefered for published books, or a UUID.
- $hash = sha1(sprintf('%s:%s', $this->wallabagUrl, implode(',', $entryIds)));
- $book->setIdentifier(sprintf('urn:wallabag:%s', $hash), EPub::IDENTIFIER_URI);
+ $hash = sha1(\sprintf('%s:%s', $this->wallabagUrl, implode(',', $entryIds)));
+ $book->setIdentifier(\sprintf('urn:wallabag:%s', $hash), EPub::IDENTIFIER_URI);
return Response::create(
$book->getBook(),
diff --git a/src/Import/PocketImport.php b/src/Import/PocketImport.php
index 1da183e98..24da0d97f 100644
--- a/src/Import/PocketImport.php
+++ b/src/Import/PocketImport.php
@@ -60,7 +60,7 @@ class PocketImport extends AbstractImport
return $response->toArray()['code'];
} catch (ExceptionInterface $e) {
- $this->logger->error(sprintf('PocketImport: Failed to request token: %s', $e->getMessage()), ['exception' => $e]);
+ $this->logger->error(\sprintf('PocketImport: Failed to request token: %s', $e->getMessage()), ['exception' => $e]);
return false;
}
@@ -88,7 +88,7 @@ class PocketImport extends AbstractImport
return true;
} catch (ExceptionInterface $e) {
- $this->logger->error(sprintf('PocketImport: Failed to authorize client: %s', $e->getMessage()), ['exception' => $e]);
+ $this->logger->error(\sprintf('PocketImport: Failed to authorize client: %s', $e->getMessage()), ['exception' => $e]);
return false;
}
@@ -132,7 +132,7 @@ class PocketImport extends AbstractImport
return true;
} catch (ExceptionInterface $e) {
- $this->logger->error(sprintf('PocketImport: Failed to import: %s', $e->getMessage()), ['exception' => $e]);
+ $this->logger->error(\sprintf('PocketImport: Failed to import: %s', $e->getMessage()), ['exception' => $e]);
return false;
}
diff --git a/src/Operator/Doctrine/Matches.php b/src/Operator/Doctrine/Matches.php
index 1e63af9f6..00e4d0b96 100644
--- a/src/Operator/Doctrine/Matches.php
+++ b/src/Operator/Doctrine/Matches.php
@@ -17,9 +17,9 @@ class Matches
public function __invoke($subject, $pattern)
{
if ("'" === $pattern[0]) {
- $pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1));
+ $pattern = \sprintf("'%%%s%%'", substr($pattern, 1, -1));
}
- return sprintf('UPPER(%s) LIKE UPPER(%s)', $subject, $pattern);
+ return \sprintf('UPPER(%s) LIKE UPPER(%s)', $subject, $pattern);
}
}
diff --git a/src/Operator/Doctrine/NotMatches.php b/src/Operator/Doctrine/NotMatches.php
index f9ea0e994..9af445bc0 100644
--- a/src/Operator/Doctrine/NotMatches.php
+++ b/src/Operator/Doctrine/NotMatches.php
@@ -17,9 +17,9 @@ class NotMatches
public function __invoke($subject, $pattern)
{
if ("'" === $pattern[0]) {
- $pattern = sprintf("'%%%s%%'", substr($pattern, 1, -1));
+ $pattern = \sprintf("'%%%s%%'", substr($pattern, 1, -1));
}
- return sprintf('UPPER(%s) NOT LIKE UPPER(%s)', $subject, $pattern);
+ return \sprintf('UPPER(%s) NOT LIKE UPPER(%s)', $subject, $pattern);
}
}
diff --git a/src/ParamConverter/UsernameFeedTokenConverter.php b/src/ParamConverter/UsernameFeedTokenConverter.php
index e9384454f..8001436d6 100644
--- a/src/ParamConverter/UsernameFeedTokenConverter.php
+++ b/src/ParamConverter/UsernameFeedTokenConverter.php
@@ -88,7 +88,7 @@ class UsernameFeedTokenConverter implements ParamConverterInterface
$user = $userRepository->findOneByUsernameAndFeedtoken($username, $feedToken);
if (null === $user || !($user instanceof User)) {
- throw new NotFoundHttpException(sprintf('%s not found.', $configuration->getClass()));
+ throw new NotFoundHttpException(\sprintf('%s not found.', $configuration->getClass()));
}
// Map found user to the route's parameter
diff --git a/src/Repository/EntryRepository.php b/src/Repository/EntryRepository.php
index 521038e56..9048cad2a 100644
--- a/src/Repository/EntryRepository.php
+++ b/src/Repository/EntryRepository.php
@@ -306,7 +306,7 @@ class EntryRepository extends ServiceEntityRepository
$fields = array_filter($fieldNames, function ($k) {
return 'content' !== $k;
});
- $qb->select(sprintf('partial e.{%s}', implode(',', $fields)));
+ $qb->select(\sprintf('partial e.{%s}', implode(',', $fields)));
}
if (null !== $isArchived) {
@@ -780,6 +780,6 @@ class EntryRepository extends ServiceEntityRepository
*/
private function sortQueryBuilder(QueryBuilder $qb, $sortBy = 'createdAt', $direction = 'desc')
{
- return $qb->orderBy(sprintf('e.%s', $sortBy), $direction);
+ return $qb->orderBy(\sprintf('e.%s', $sortBy), $direction);
}
}
diff --git a/src/Twig/WallabagExtension.php b/src/Twig/WallabagExtension.php
index 8f23fae3b..5b37a4408 100644
--- a/src/Twig/WallabagExtension.php
+++ b/src/Twig/WallabagExtension.php
@@ -111,7 +111,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
$qb = $this->entryRepository->getCountBuilderForAllByUser($user->getId());
break;
default:
- throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type));
+ throw new \InvalidArgumentException(\sprintf('Type "%s" is not implemented.', $type));
}
$query = $qb
diff --git a/tests/Controller/EntryControllerTest.php b/tests/Controller/EntryControllerTest.php
index 86d74a1d7..5c7599f52 100644
--- a/tests/Controller/EntryControllerTest.php
+++ b/tests/Controller/EntryControllerTest.php
@@ -1709,7 +1709,7 @@ class EntryControllerTest extends WallabagTestCase
// the deletion link of the first tag
$link = $crawler->filter('body div#article div.tools ul.tags li.chip a')->extract(['href'])[1];
- $this->assertStringStartsWith(sprintf('/remove-tag/%s/%s', $entry->getId(), $tag->getId()), $link);
+ $this->assertStringStartsWith(\sprintf('/remove-tag/%s/%s', $entry->getId(), $tag->getId()), $link);
}
public function testRandom()