Merge pull request #7609 from wallabag/dependabot/composer/friendsofphp/php-cs-fixer-3.62.0

Bump friendsofphp/php-cs-fixer from 3.59.3 to 3.62.0
This commit is contained in:
Jérémy Benoist 2024-08-14 16:49:49 +02:00 committed by GitHub
commit 6893d6b2cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 74 additions and 74 deletions

34
composer.lock generated
View file

@ -16661,16 +16661,16 @@
}, },
{ {
"name": "friendsofphp/php-cs-fixer", "name": "friendsofphp/php-cs-fixer",
"version": "v3.59.3", "version": "v3.62.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29" "reference": "627692f794d35c43483f34b01d94740df2a73507"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/30ba9ecc2b0e5205e578fe29973c15653d9bfd29", "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/627692f794d35c43483f34b01d94740df2a73507",
"reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29", "reference": "627692f794d35c43483f34b01d94740df2a73507",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -16752,7 +16752,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.59.3" "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.62.0"
}, },
"funding": [ "funding": [
{ {
@ -16760,7 +16760,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-06-16T14:17:03+00:00" "time": "2024-08-07T17:03:09+00:00"
}, },
{ {
"name": "friendsoftwig/twigcs", "name": "friendsoftwig/twigcs",
@ -18308,31 +18308,31 @@
}, },
{ {
"name": "react/socket", "name": "react/socket",
"version": "v1.15.0", "version": "v1.16.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/reactphp/socket.git", "url": "https://github.com/reactphp/socket.git",
"reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038" "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/reactphp/socket/zipball/216d3aec0b87f04a40ca04f481e6af01bdd1d038", "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1",
"reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038", "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"evenement/evenement": "^3.0 || ^2.0 || ^1.0", "evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"php": ">=5.3.0", "php": ">=5.3.0",
"react/dns": "^1.11", "react/dns": "^1.13",
"react/event-loop": "^1.2", "react/event-loop": "^1.2",
"react/promise": "^3 || ^2.6 || ^1.2.1", "react/promise": "^3.2 || ^2.6 || ^1.2.1",
"react/stream": "^1.2" "react/stream": "^1.4"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
"react/async": "^4 || ^3 || ^2", "react/async": "^4.3 || ^3.3 || ^2",
"react/promise-stream": "^1.4", "react/promise-stream": "^1.4",
"react/promise-timer": "^1.10" "react/promise-timer": "^1.11"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -18376,7 +18376,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/reactphp/socket/issues", "issues": "https://github.com/reactphp/socket/issues",
"source": "https://github.com/reactphp/socket/tree/v1.15.0" "source": "https://github.com/reactphp/socket/tree/v1.16.0"
}, },
"funding": [ "funding": [
{ {
@ -18384,7 +18384,7 @@
"type": "open_collective" "type": "open_collective"
} }
], ],
"time": "2023-12-15T11:02:10+00:00" "time": "2024-07-26T10:38:09+00:00"
}, },
{ {
"name": "react/stream", "name": "react/stream",

View file

@ -65,7 +65,7 @@ class CleanDownloadedImagesCommand extends Command
$existingPaths[] = $file->getFilename(); $existingPaths[] = $file->getFilename();
} }
$io->text(sprintf(' -> <info>%d</info> images found', \count($existingPaths))); $io->text(\sprintf(' -> <info>%d</info> images found', \count($existingPaths)));
$io->text('Retrieve valid folders attached to a user'); $io->text('Retrieve valid folders attached to a user');
@ -84,7 +84,7 @@ class CleanDownloadedImagesCommand extends Command
$validPaths[] = explode('/', $path)[2]; $validPaths[] = explode('/', $path)[2];
} }
$io->text(sprintf(' -> <info>%d</info> folders found', \count($validPaths))); $io->text(\sprintf(' -> <info>%d</info> folders found', \count($validPaths)));
$deletedCount = 0; $deletedCount = 0;
@ -103,11 +103,11 @@ class CleanDownloadedImagesCommand extends Command
$deletedCount += \count($files); $deletedCount += \count($files);
$io->text(sprintf('Deleted images in <info>%s</info>: <info>%d</info>', $existingPath, \count($files))); $io->text(\sprintf('Deleted images in <info>%s</info>: <info>%d</info>', $existingPath, \count($files)));
} }
} }
$io->success(sprintf('Finished cleaning. %d deleted images', $deletedCount)); $io->success(\sprintf('Finished cleaning. %d deleted images', $deletedCount));
return 0; return 0;
} }

View file

@ -56,7 +56,7 @@ class CleanDuplicatesCommand extends Command
$user = $this->getUser($username); $user = $this->getUser($username);
$this->cleanDuplicates($user); $this->cleanDuplicates($user);
} catch (NoResultException $e) { } catch (NoResultException $e) {
$this->io->error(sprintf('User "%s" not found.', $username)); $this->io->error(\sprintf('User "%s" not found.', $username));
return 1; return 1;
} }
@ -65,13 +65,13 @@ class CleanDuplicatesCommand extends Command
} else { } else {
$users = $this->userRepository->findAll(); $users = $this->userRepository->findAll();
$this->io->text(sprintf('Cleaning through <info>%d</info> user accounts', \count($users))); $this->io->text(\sprintf('Cleaning through <info>%d</info> user accounts', \count($users)));
foreach ($users as $user) { foreach ($users as $user) {
$this->io->text(sprintf('Processing user <info>%s</info>', $user->getUsername())); $this->io->text(\sprintf('Processing user <info>%s</info>', $user->getUsername()));
$this->cleanDuplicates($user); $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; return 0;
@ -99,7 +99,7 @@ class CleanDuplicatesCommand extends Command
$this->duplicates += $duplicatesCount; $this->duplicates += $duplicatesCount;
$this->io->text(sprintf('Cleaned <info>%d</info> duplicates for user <info>%s</info>', $duplicatesCount, $user->getUserName())); $this->io->text(\sprintf('Cleaned <info>%d</info> duplicates for user <info>%s</info>', $duplicatesCount, $user->getUserName()));
} }
private function similarUrl($url) private function similarUrl($url)

View file

@ -56,7 +56,7 @@ class ExportCommand extends Command
try { try {
$user = $this->userRepository->findOneByUserName($input->getArgument('username')); $user = $this->userRepository->findOneByUserName($input->getArgument('username'));
} catch (NoResultException $e) { } 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; return 1;
} }
@ -66,12 +66,12 @@ class ExportCommand extends Command
->getQuery() ->getQuery()
->getResult(); ->getResult();
$io->text(sprintf('Exporting <info>%d</info> entrie(s) for user <info>%s</info>...', \count($entries), $user->getUserName())); $io->text(\sprintf('Exporting <info>%d</info> entrie(s) for user <info>%s</info>...', \count($entries), $user->getUserName()));
$filePath = $input->getArgument('filepath'); $filePath = $input->getArgument('filepath');
if (!$filePath) { if (!$filePath) {
$filePath = $this->projectDir . '/' . sprintf('%s-export.json', $user->getUsername()); $filePath = $this->projectDir . '/' . \sprintf('%s-export.json', $user->getUsername());
} }
try { try {
@ -82,7 +82,7 @@ class ExportCommand extends Command
->exportJsonData(); ->exportJsonData();
file_put_contents($filePath, $data); file_put_contents($filePath, $data);
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {
$io->error(sprintf('Error: "%s"', $e->getMessage())); $io->error(\sprintf('Error: "%s"', $e->getMessage()));
return 1; return 1;
} }

View file

@ -50,17 +50,17 @@ class GenerateUrlHashesCommand extends Command
$user = $this->getUser($username); $user = $this->getUser($username);
$this->generateHashedUrls($user); $this->generateHashedUrls($user);
} catch (NoResultException $e) { } catch (NoResultException $e) {
$output->writeln(sprintf('<error>User "%s" not found.</error>', $username)); $output->writeln(\sprintf('<error>User "%s" not found.</error>', $username));
return 1; return 1;
} }
} else { } else {
$users = $this->userRepository->findAll(); $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) { foreach ($users as $user) {
$output->writeln(sprintf('Processing user: %s', $user->getUsername())); $output->writeln(\sprintf('Processing user: %s', $user->getUsername()));
$this->generateHashedUrls($user); $this->generateHashedUrls($user);
} }
$output->writeln('Finished generated hashed urls'); $output->writeln('Finished generated hashed urls');
@ -86,7 +86,7 @@ class GenerateUrlHashesCommand extends Command
$this->entityManager->flush(); $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()));
} }
/** /**

View file

@ -98,7 +98,7 @@ class ImportCommand extends Command
$output->writeln('Start : ' . (new \DateTime())->format('d-m-Y G:i:s') . ' ---'); $output->writeln('Start : ' . (new \DateTime())->format('d-m-Y G:i:s') . ' ---');
if (!file_exists($input->getArgument('filepath'))) { 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 // Turning off doctrine default logs queries for saving memory
@ -115,7 +115,7 @@ class ImportCommand extends Command
} }
if (!\is_object($entityUser)) { 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 // Authenticate user for paywalled websites

View file

@ -41,7 +41,7 @@ class RedisWorkerCommand extends Command
$serviceName = $input->getArgument('serviceName'); $serviceName = $input->getArgument('serviceName');
if (!$this->container->has('wallabag.queue.redis.' . $serviceName) || !$this->container->has('wallabag.consumer.redis.' . $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( $worker = new QueueWorker(

View file

@ -109,7 +109,7 @@ class InstallCommand extends Command
$help = 'Database driver "' . $this->databaseDriver . '" is not installed.'; $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 // testing if connection to the database can be established
$label = '<comment>Database connection</comment>'; $label = '<comment>Database connection</comment>';
@ -388,12 +388,12 @@ class InstallCommand extends Command
$schemaManager = $connection->createSchemaManager(); $schemaManager = $connection->createSchemaManager();
} catch (\Exception $exception) { } catch (\Exception $exception) {
// mysql & sqlite // mysql & sqlite
if (str_contains($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) { if (str_contains($exception->getMessage(), \sprintf("Unknown database '%s'", $databaseName))) {
return false; return false;
} }
// pgsql // 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; return false;
} }

View file

@ -59,7 +59,7 @@ class ListUserCommand extends Command
$io->table(['username', 'email', 'is enabled?', 'is admin?'], $rows); $io->table(['username', 'email', 'is enabled?', 'is admin?'], $rows);
$io->success( $io->success(
sprintf( \sprintf(
'%s/%s%s user(s) displayed.', '%s/%s%s user(s) displayed.',
\count($users), \count($users),
$nbUsers, $nbUsers,

View file

@ -63,7 +63,7 @@ class ReloadEntryCommand extends Command
->findOneByUserName($username) ->findOneByUserName($username)
->getId(); ->getId();
} catch (NoResultException $e) { } catch (NoResultException $e) {
$io->error(sprintf('User "%s" not found.', $username)); $io->error(\sprintf('User "%s" not found.', $username));
return 1; return 1;
} }
@ -80,7 +80,7 @@ class ReloadEntryCommand extends Command
} }
$io->note( $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.", "You're going to reload %s entries. Depending on the number of entry to reload, this could be a very long process.",
$nbEntries $nbEntries
) )

View file

@ -47,7 +47,7 @@ class ShowUserCommand extends Command
$user = $this->getUser($username); $user = $this->getUser($username);
$this->showUser($user); $this->showUser($user);
} catch (NoResultException $e) { } catch (NoResultException $e) {
$this->io->error(sprintf('User "%s" not found.', $username)); $this->io->error(\sprintf('User "%s" not found.', $username));
return 1; return 1;
} }
@ -58,13 +58,13 @@ class ShowUserCommand extends Command
private function showUser(User $user) private function showUser(User $user)
{ {
$this->io->listing([ $this->io->listing([
sprintf('Username: %s', $user->getUsername()), \sprintf('Username: %s', $user->getUsername()),
sprintf('Email: %s', $user->getEmail()), \sprintf('Email: %s', $user->getEmail()),
sprintf('Display name: %s', $user->getName()), \sprintf('Display name: %s', $user->getName()),
sprintf('Creation date: %s', $user->getCreatedAt()->format('Y-m-d H:i:s')), \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('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 (email) activated: %s', $user->isEmailTwoFactor() ? 'yes' : 'no'),
sprintf('2FA (OTP) activated: %s', $user->isGoogleAuthenticatorEnabled() ? 'yes' : 'no'), \sprintf('2FA (OTP) activated: %s', $user->isGoogleAuthenticatorEnabled() ? 'yes' : 'no'),
]); ]);
} }

View file

@ -49,12 +49,12 @@ class TagAllCommand extends Command
try { try {
$user = $this->getUser($input->getArgument('username')); $user = $this->getUser($input->getArgument('username'));
} catch (NoResultException $e) { } 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; return 1;
} }
$io->text(sprintf('Tagging entries for user <info>%s</info>...', $user->getUserName())); $io->text(\sprintf('Tagging entries for user <info>%s</info>...', $user->getUserName()));
$entries = $this->ruleBasedTagger->tagAllForUser($user); $entries = $this->ruleBasedTagger->tagAllForUser($user);

View file

@ -1088,7 +1088,7 @@ class EntryRestController extends WallabagRestController
{ {
$expect = $request->query->get('expect', 'entry'); $expect = $request->query->get('expect', 'entry');
if (!\in_array($expect, ['id', 'entry'], true)) { 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->validateAuthentication();
$this->validateUserAccess($entry->getUser()->getId()); $this->validateUserAccess($entry->getUser()->getId());

View file

@ -657,7 +657,7 @@ class EntryController extends AbstractController
$qb = $this->entryRepository->getBuilderForAllByUser($this->getUser()->getId()); $qb = $this->entryRepository->getBuilderForAllByUser($this->getUser()->getId());
break; break;
default: 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); $form = $this->createForm(EntryFilterType::class, [], $formOptions);

View file

@ -102,7 +102,7 @@ class FeedController extends AbstractController
]; ];
if (!isset($sorts[$sort])) { 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( $url = $this->generateUrl(
@ -200,7 +200,7 @@ class FeedController extends AbstractController
$qb = $this->entryRepository->getBuilderForAllByUser($user->getId()); $qb = $this->entryRepository->getBuilderForAllByUser($user->getId());
break; break;
default: 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); $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false);

View file

@ -114,7 +114,7 @@ class EntryFilterType extends AbstractType
return false; return false;
} }
$paramName = sprintf('%s', str_replace('.', '_', $field)); $paramName = \sprintf('%s', str_replace('.', '_', $field));
$expression = $filterQuery->getExpr()->eq($field, ':' . $paramName); $expression = $filterQuery->getExpr()->eq($field, ':' . $paramName);
$parameters = [$paramName => $value]; $parameters = [$paramName => $value];

View file

@ -119,7 +119,7 @@ class EntriesExport
return $this->$functionName(); 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() public function exportJsonData()
@ -196,7 +196,7 @@ class EntriesExport
foreach ($entry->getTags() as $tag) { foreach ($entry->getTags() as $tag) {
$book->setSubject($tag->getLabel()); $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(); $publishedBy = $entry->getPublishedBy();
$authors = $this->translator->trans('export.unknown'); $authors = $this->translator->trans('export.unknown');
@ -232,8 +232,8 @@ class EntriesExport
$book->addChapter('Notices', 'Cover2.html', $content_start . $this->getExportInformation('PHPePub') . $bookEnd); $book->addChapter('Notices', 'Cover2.html', $content_start . $this->getExportInformation('PHPePub') . $bookEnd);
// Could also be the ISBN number, prefered for published books, or a UUID. // Could also be the ISBN number, prefered for published books, or a UUID.
$hash = sha1(sprintf('%s:%s', $this->wallabagUrl, implode(',', $entryIds))); $hash = sha1(\sprintf('%s:%s', $this->wallabagUrl, implode(',', $entryIds)));
$book->setIdentifier(sprintf('urn:wallabag:%s', $hash), EPub::IDENTIFIER_URI); $book->setIdentifier(\sprintf('urn:wallabag:%s', $hash), EPub::IDENTIFIER_URI);
return Response::create( return Response::create(
$book->getBook(), $book->getBook(),

View file

@ -60,7 +60,7 @@ class PocketImport extends AbstractImport
return $response->toArray()['code']; return $response->toArray()['code'];
} catch (ExceptionInterface $e) { } 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; return false;
} }
@ -88,7 +88,7 @@ class PocketImport extends AbstractImport
return true; return true;
} catch (ExceptionInterface $e) { } 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; return false;
} }
@ -132,7 +132,7 @@ class PocketImport extends AbstractImport
return true; return true;
} catch (ExceptionInterface $e) { } 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; return false;
} }

View file

@ -17,9 +17,9 @@ class Matches
public function __invoke($subject, $pattern) public function __invoke($subject, $pattern)
{ {
if ("'" === $pattern[0]) { 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);
} }
} }

View file

@ -17,9 +17,9 @@ class NotMatches
public function __invoke($subject, $pattern) public function __invoke($subject, $pattern)
{ {
if ("'" === $pattern[0]) { 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);
} }
} }

View file

@ -88,7 +88,7 @@ class UsernameFeedTokenConverter implements ParamConverterInterface
$user = $userRepository->findOneByUsernameAndFeedtoken($username, $feedToken); $user = $userRepository->findOneByUsernameAndFeedtoken($username, $feedToken);
if (null === $user || !($user instanceof User)) { 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 // Map found user to the route's parameter

View file

@ -306,7 +306,7 @@ class EntryRepository extends ServiceEntityRepository
$fields = array_filter($fieldNames, function ($k) { $fields = array_filter($fieldNames, function ($k) {
return 'content' !== $k; return 'content' !== $k;
}); });
$qb->select(sprintf('partial e.{%s}', implode(',', $fields))); $qb->select(\sprintf('partial e.{%s}', implode(',', $fields)));
} }
if (null !== $isArchived) { if (null !== $isArchived) {
@ -780,6 +780,6 @@ class EntryRepository extends ServiceEntityRepository
*/ */
private function sortQueryBuilder(QueryBuilder $qb, $sortBy = 'createdAt', $direction = 'desc') 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);
} }
} }

View file

@ -111,7 +111,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
$qb = $this->entryRepository->getCountBuilderForAllByUser($user->getId()); $qb = $this->entryRepository->getCountBuilderForAllByUser($user->getId());
break; break;
default: default:
throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); throw new \InvalidArgumentException(\sprintf('Type "%s" is not implemented.', $type));
} }
$query = $qb $query = $qb

View file

@ -1709,7 +1709,7 @@ class EntryControllerTest extends WallabagTestCase
// the deletion link of the first tag // the deletion link of the first tag
$link = $crawler->filter('body div#article div.tools ul.tags li.chip a')->extract(['href'])[1]; $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() public function testRandom()