1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-26 18:21:02 +00:00

Modernize to PHP 8.0

This commit is contained in:
Yassine Guedidi 2025-04-05 13:56:56 +02:00
parent 1d5674a230
commit a107773c11
31 changed files with 97 additions and 199 deletions

View file

@ -89,25 +89,14 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
return 0;
}
switch ($type) {
case 'starred':
$qb = $this->entryRepository->getCountBuilderForStarredByUser($user->getId())->select('COUNT(e.id)');
break;
case 'archive':
$qb = $this->entryRepository->getCountBuilderForArchiveByUser($user->getId())->select('COUNT(e.id)');
break;
case 'unread':
$qb = $this->entryRepository->getCountBuilderForUnreadByUser($user->getId())->select('COUNT(e.id)');
break;
case 'annotated':
$qb = $this->annotationRepository->getCountBuilderByUser($user->getId())->select('COUNT(DISTINCT e.entry)');
break;
case 'all':
$qb = $this->entryRepository->getCountBuilderForAllByUser($user->getId())->select('COUNT(e.id)');
break;
default:
throw new \InvalidArgumentException(\sprintf('Type "%s" is not implemented.', $type));
}
$qb = match ($type) {
'starred' => $this->entryRepository->getCountBuilderForStarredByUser($user->getId())->select('COUNT(e.id)'),
'archive' => $this->entryRepository->getCountBuilderForArchiveByUser($user->getId())->select('COUNT(e.id)'),
'unread' => $this->entryRepository->getCountBuilderForUnreadByUser($user->getId())->select('COUNT(e.id)'),
'annotated' => $this->annotationRepository->getCountBuilderByUser($user->getId())->select('COUNT(DISTINCT e.entry)'),
'all' => $this->entryRepository->getCountBuilderForAllByUser($user->getId())->select('COUNT(e.id)'),
default => throw new \InvalidArgumentException(\sprintf('Type "%s" is not implemented.', $type)),
};
$query = $qb->getQuery();
$query->useQueryCache(true);