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

@ -379,7 +379,7 @@ class EntryController extends AbstractController
try {
$entry = $this->entryRepository
->getRandomEntry($this->getUser()->getId(), $type);
} catch (NoResultException $e) {
} catch (NoResultException) {
$this->addFlash('notice', 'flashes.entry.notice.no_random_entry');
return $this->redirect($this->generateUrl($type));
@ -670,7 +670,7 @@ class EntryController extends AbstractController
try {
$entries->setCurrentPage($page);
} catch (OutOfRangeCurrentPageException $e) {
} catch (OutOfRangeCurrentPageException) {
if ($page > 1) {
return $this->redirect($this->generateUrl($type, ['page' => $entries->getNbPages()]), 302);
}
@ -699,7 +699,7 @@ class EntryController extends AbstractController
try {
$this->contentProxy->updateEntry($entry, $entry->getUrl());
} catch (\Exception $e) {
} catch (\Exception) {
// $this->logger->error('Error while saving an entry', [
// 'exception' => $e,
// 'entry' => $entry,

View file

@ -141,7 +141,7 @@ class FeedController extends AbstractController
try {
$entries->setCurrentPage($page);
} catch (OutOfRangeCurrentPageException $e) {
} catch (OutOfRangeCurrentPageException) {
if ($page > 1) {
return $this->redirect($url . '?page=' . $entries->getNbPages(), 302);
}
@ -189,22 +189,13 @@ class FeedController extends AbstractController
*/
private function showEntries(string $type, User $user, $page = 1)
{
switch ($type) {
case 'starred':
$qb = $this->entryRepository->getBuilderForStarredByUser($user->getId());
break;
case 'archive':
$qb = $this->entryRepository->getBuilderForArchiveByUser($user->getId());
break;
case 'unread':
$qb = $this->entryRepository->getBuilderForUnreadByUser($user->getId());
break;
case 'all':
$qb = $this->entryRepository->getBuilderForAllByUser($user->getId());
break;
default:
throw new \InvalidArgumentException(\sprintf('Type "%s" is not implemented.', $type));
}
$qb = match ($type) {
'starred' => $this->entryRepository->getBuilderForStarredByUser($user->getId()),
'archive' => $this->entryRepository->getBuilderForArchiveByUser($user->getId()),
'unread' => $this->entryRepository->getBuilderForUnreadByUser($user->getId()),
'all' => $this->entryRepository->getBuilderForAllByUser($user->getId()),
default => throw new \InvalidArgumentException(\sprintf('Type "%s" is not implemented.', $type)),
};
$pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false);
$entries = new Pagerfanta($pagerAdapter);
@ -223,7 +214,7 @@ class FeedController extends AbstractController
try {
$entries->setCurrentPage((int) $page);
} catch (OutOfRangeCurrentPageException $e) {
} catch (OutOfRangeCurrentPageException) {
if ($page > 1) {
return $this->redirect($url . '/' . $entries->getNbPages());
}

View file

@ -62,7 +62,7 @@ class ImportController extends AbstractController
+ $this->rabbitMQConsumerTotalProxy->getTotalMessage('pocket_html')
+ $this->rabbitMQConsumerTotalProxy->getTotalMessage('omnivore')
;
} catch (\Exception $e) {
} catch (\Exception) {
$rabbitNotInstalled = true;
}
} elseif ($craueConfig->get('import_with_redis')) {
@ -81,7 +81,7 @@ class ImportController extends AbstractController
+ $this->redisClient->llen('wallabag.import.pocket_html')
+ $this->redisClient->llen('wallabag.import.omnivore')
;
} catch (\Exception $e) {
} catch (\Exception) {
$redisNotInstalled = true;
}
}

View file

@ -153,7 +153,7 @@ class TagController extends AbstractController
try {
$entries->setCurrentPage($page);
} catch (OutOfRangeCurrentPageException $e) {
} catch (OutOfRangeCurrentPageException) {
if ($page > 1) {
return $this->redirect($this->generateUrl($request->attributes->get('_route'), [
'slug' => $tag->getSlug(),

View file

@ -169,7 +169,7 @@ class UserController extends AbstractController
try {
$pagerFanta->setCurrentPage($page);
} catch (OutOfRangeCurrentPageException $e) {
} catch (OutOfRangeCurrentPageException) {
if ($page > 1) {
return $this->redirect($this->generateUrl('user_index', ['page' => $pagerFanta->getNbPages()]), 302);
}