1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-16 18:01:38 +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

@ -51,7 +51,7 @@ class CleanDuplicatesCommand extends Command
try {
$user = $this->getUser($username);
$this->cleanDuplicates($user);
} catch (NoResultException $e) {
} catch (NoResultException) {
$this->io->error(\sprintf('User "%s" not found.', $username));
return 1;

View file

@ -45,7 +45,7 @@ class GenerateUrlHashesCommand extends Command
try {
$user = $this->getUser($username);
$this->generateHashedUrls($user);
} catch (NoResultException $e) {
} catch (NoResultException) {
$output->writeln(\sprintf('<error>User "%s" not found.</error>', $username));
return 1;

View file

@ -97,43 +97,20 @@ class ImportCommand extends Command
$this->tokenStorage->setToken($token);
$user = $this->tokenStorage->getToken()->getUser();
switch ($input->getOption('importer')) {
case 'v2':
$import = $this->wallabagV2Import;
break;
case 'firefox':
$import = $this->firefoxImport;
break;
case 'chrome':
$import = $this->chromeImport;
break;
case 'readability':
$import = $this->readabilityImport;
break;
case 'instapaper':
$import = $this->instapaperImport;
break;
case 'pinboard':
$import = $this->pinboardImport;
break;
case 'delicious':
$import = $this->deliciousImport;
break;
case 'elcurator':
$import = $this->elcuratorImport;
break;
case 'shaarli':
$import = $this->shaarliImport;
break;
case 'pocket':
$import = $this->pocketHtmlImport;
break;
case 'omnivore':
$import = $this->omnivoreImport;
break;
default:
$import = $this->wallabagV1Import;
}
$import = match ($input->getOption('importer')) {
'v2' => $this->wallabagV2Import,
'firefox' => $this->firefoxImport,
'chrome' => $this->chromeImport,
'readability' => $this->readabilityImport,
'instapaper' => $this->instapaperImport,
'pinboard' => $this->pinboardImport,
'delicious' => $this->deliciousImport,
'elcurator' => $this->elcuratorImport,
'shaarli' => $this->shaarliImport,
'pocket' => $this->pocketHtmlImport,
'omnivore' => $this->omnivoreImport,
default => $this->wallabagV1Import,
};
$import->setMarkAsRead($input->getOption('markAsRead'));
$import->setDisableContentUpdate($input->getOption('disableContentUpdate'));

View file

@ -402,7 +402,7 @@ class InstallCommand extends Command
try {
return \in_array($databaseName, $schemaManager->listDatabases(), true);
} catch (DriverException $e) {
} catch (DriverException) {
// it means we weren't able to get database list, assume the database doesn't exist
return false;

View file

@ -55,7 +55,7 @@ class ReloadEntryCommand extends Command
$userId = $this->userRepository
->findOneByUserName($username)
->getId();
} catch (NoResultException $e) {
} catch (NoResultException) {
$io->error(\sprintf('User "%s" not found.', $username));
return 1;

View file

@ -44,7 +44,7 @@ class ShowUserCommand extends Command
try {
$user = $this->getUser($username);
$this->showUser($user);
} catch (NoResultException $e) {
} catch (NoResultException) {
$this->io->error(\sprintf('User "%s" not found.', $username));
return 1;

View file

@ -43,7 +43,7 @@ class TagAllCommand extends Command
try {
$user = $this->getUser($input->getArgument('username'));
} catch (NoResultException $e) {
} catch (NoResultException) {
$io->error(\sprintf('User "%s" not found.', $input->getArgument('username')));
return 1;