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

Migrate to constructor promoted properties

This commit is contained in:
Yassine Guedidi 2025-04-05 13:54:27 +02:00
parent 4168727f36
commit 1d5674a230
85 changed files with 441 additions and 854 deletions

View file

@ -16,14 +16,10 @@ class CleanDownloadedImagesCommand extends Command
protected static $defaultName = 'wallabag:clean-downloaded-images';
protected static $defaultDescription = 'Cleans downloaded images which are no more associated to an entry';
private EntryRepository $entryRepository;
private DownloadImages $downloadImages;
public function __construct(EntryRepository $entryRepository, DownloadImages $downloadImages)
{
$this->entryRepository = $entryRepository;
$this->downloadImages = $downloadImages;
public function __construct(
private EntryRepository $entryRepository,
private DownloadImages $downloadImages,
) {
parent::__construct();
}

View file

@ -21,16 +21,12 @@ class CleanDuplicatesCommand extends Command
protected SymfonyStyle $io;
protected int $duplicates = 0;
private EntityManagerInterface $entityManager;
private EntryRepository $entryRepository;
private UserRepository $userRepository;
public function __construct(EntityManagerInterface $entityManager, EntryRepository $entryRepository, UserRepository $userRepository)
{
$this->entityManager = $entityManager;
$this->entryRepository = $entryRepository;
$this->userRepository = $userRepository;
public function __construct(
private EntityManagerInterface $entityManager,
private EntryRepository $entryRepository,
private UserRepository $userRepository,
) {
parent::__construct();
}

View file

@ -17,18 +17,12 @@ class ExportCommand extends Command
protected static $defaultName = 'wallabag:export';
protected static $defaultDescription = 'Export all entries for an user';
private EntryRepository $entryRepository;
private UserRepository $userRepository;
private EntriesExport $entriesExport;
private string $projectDir;
public function __construct(EntryRepository $entryRepository, UserRepository $userRepository, EntriesExport $entriesExport, string $projectDir)
{
$this->entryRepository = $entryRepository;
$this->userRepository = $userRepository;
$this->entriesExport = $entriesExport;
$this->projectDir = $projectDir;
public function __construct(
private EntryRepository $entryRepository,
private UserRepository $userRepository,
private EntriesExport $entriesExport,
private string $projectDir,
) {
parent::__construct();
}

View file

@ -19,16 +19,12 @@ class GenerateUrlHashesCommand extends Command
protected static $defaultDescription = 'Generates hashed urls for each entry';
protected OutputInterface $output;
private EntityManagerInterface $entityManager;
private EntryRepository $entryRepository;
private UserRepository $userRepository;
public function __construct(EntityManagerInterface $entityManager, EntryRepository $entryRepository, UserRepository $userRepository)
{
$this->entityManager = $entityManager;
$this->entryRepository = $entryRepository;
$this->userRepository = $userRepository;
public function __construct(
private EntityManagerInterface $entityManager,
private EntryRepository $entryRepository,
private UserRepository $userRepository,
) {
parent::__construct();
}

View file

@ -33,55 +33,23 @@ class ImportCommand extends Command
protected static $defaultName = 'wallabag:import';
protected static $defaultDescription = 'Import entries from a JSON export';
private EntityManagerInterface $entityManager;
private TokenStorageInterface $tokenStorage;
private UserRepository $userRepository;
private WallabagV2Import $wallabagV2Import;
private FirefoxImport $firefoxImport;
private ChromeImport $chromeImport;
private ReadabilityImport $readabilityImport;
private InstapaperImport $instapaperImport;
private PinboardImport $pinboardImport;
private DeliciousImport $deliciousImport;
private OmnivoreImport $omnivoreImport;
private WallabagV1Import $wallabagV1Import;
private ElcuratorImport $elcuratorImport;
private ShaarliImport $shaarliImport;
private PocketHtmlImport $pocketHtmlImport;
public function __construct(
EntityManagerInterface $entityManager,
TokenStorageInterface $tokenStorage,
UserRepository $userRepository,
WallabagV2Import $wallabagV2Import,
FirefoxImport $firefoxImport,
ChromeImport $chromeImport,
ReadabilityImport $readabilityImport,
InstapaperImport $instapaperImport,
PinboardImport $pinboardImport,
DeliciousImport $deliciousImport,
WallabagV1Import $wallabagV1Import,
ElcuratorImport $elcuratorImport,
ShaarliImport $shaarliImport,
PocketHtmlImport $pocketHtmlImport,
OmnivoreImport $omnivoreImport,
private EntityManagerInterface $entityManager,
private TokenStorageInterface $tokenStorage,
private UserRepository $userRepository,
private WallabagV2Import $wallabagV2Import,
private FirefoxImport $firefoxImport,
private ChromeImport $chromeImport,
private ReadabilityImport $readabilityImport,
private InstapaperImport $instapaperImport,
private PinboardImport $pinboardImport,
private DeliciousImport $deliciousImport,
private WallabagV1Import $wallabagV1Import,
private ElcuratorImport $elcuratorImport,
private ShaarliImport $shaarliImport,
private PocketHtmlImport $pocketHtmlImport,
private OmnivoreImport $omnivoreImport,
) {
$this->entityManager = $entityManager;
$this->tokenStorage = $tokenStorage;
$this->userRepository = $userRepository;
$this->wallabagV2Import = $wallabagV2Import;
$this->firefoxImport = $firefoxImport;
$this->chromeImport = $chromeImport;
$this->readabilityImport = $readabilityImport;
$this->instapaperImport = $instapaperImport;
$this->pinboardImport = $pinboardImport;
$this->deliciousImport = $deliciousImport;
$this->omnivoreImport = $omnivoreImport;
$this->wallabagV1Import = $wallabagV1Import;
$this->elcuratorImport = $elcuratorImport;
$this->shaarliImport = $shaarliImport;
$this->pocketHtmlImport = $pocketHtmlImport;
parent::__construct();
}

View file

@ -16,12 +16,9 @@ class RedisWorkerCommand extends Command
protected static $defaultName = 'wallabag:import:redis-worker';
protected static $defaultDescription = 'Launch Redis worker';
private $container;
public function __construct(ContainerInterface $container)
{
$this->container = $container;
public function __construct(
private ContainerInterface $container,
) {
parent::__construct();
}

View file

@ -37,24 +37,15 @@ class InstallCommand extends Command
'curl_multi_init',
];
private EntityManagerInterface $entityManager;
private EventDispatcherInterface $dispatcher;
private UserManagerInterface $userManager;
private TableMetadataStorageConfiguration $tableMetadataStorageConfiguration;
private string $databaseDriver;
private array $defaultSettings;
private array $defaultIgnoreOriginInstanceRules;
public function __construct(EntityManagerInterface $entityManager, EventDispatcherInterface $dispatcher, UserManagerInterface $userManager, TableMetadataStorageConfiguration $tableMetadataStorageConfiguration, string $databaseDriver, array $defaultSettings, array $defaultIgnoreOriginInstanceRules)
{
$this->entityManager = $entityManager;
$this->dispatcher = $dispatcher;
$this->userManager = $userManager;
$this->tableMetadataStorageConfiguration = $tableMetadataStorageConfiguration;
$this->databaseDriver = $databaseDriver;
$this->defaultSettings = $defaultSettings;
$this->defaultIgnoreOriginInstanceRules = $defaultIgnoreOriginInstanceRules;
public function __construct(
private EntityManagerInterface $entityManager,
private EventDispatcherInterface $dispatcher,
private UserManagerInterface $userManager,
private TableMetadataStorageConfiguration $tableMetadataStorageConfiguration,
private string $databaseDriver,
private array $defaultSettings,
private array $defaultIgnoreOriginInstanceRules,
) {
parent::__construct();
}

View file

@ -15,12 +15,9 @@ class ListUserCommand extends Command
protected static $defaultName = 'wallabag:user:list';
protected static $defaultDescription = 'List all users';
private UserRepository $userRepository;
public function __construct(UserRepository $userRepository)
{
$this->userRepository = $userRepository;
public function __construct(
private UserRepository $userRepository,
) {
parent::__construct();
}

View file

@ -21,20 +21,13 @@ class ReloadEntryCommand extends Command
protected static $defaultName = 'wallabag:entry:reload';
protected static $defaultDescription = 'Reload entries';
private EntryRepository $entryRepository;
private UserRepository $userRepository;
private EntityManagerInterface $entityManager;
private ContentProxy $contentProxy;
private EventDispatcherInterface $dispatcher;
public function __construct(EntryRepository $entryRepository, UserRepository $userRepository, EntityManagerInterface $entityManager, ContentProxy $contentProxy, EventDispatcherInterface $dispatcher)
{
$this->entryRepository = $entryRepository;
$this->userRepository = $userRepository;
$this->entityManager = $entityManager;
$this->contentProxy = $contentProxy;
$this->dispatcher = $dispatcher;
public function __construct(
private EntryRepository $entryRepository,
private UserRepository $userRepository,
private EntityManagerInterface $entityManager,
private ContentProxy $contentProxy,
private EventDispatcherInterface $dispatcher,
) {
parent::__construct();
}

View file

@ -17,12 +17,10 @@ class ShowUserCommand extends Command
protected static $defaultDescription = 'Show user details';
protected SymfonyStyle $io;
private UserRepository $userRepository;
public function __construct(UserRepository $userRepository)
{
$this->userRepository = $userRepository;
public function __construct(
private UserRepository $userRepository,
) {
parent::__construct();
}

View file

@ -18,16 +18,11 @@ class TagAllCommand extends Command
protected static $defaultName = 'wallabag:tag:all';
protected static $defaultDescription = 'Tag all entries using the tagging rules.';
private EntityManagerInterface $entityManager;
private RuleBasedTagger $ruleBasedTagger;
private UserRepository $userRepository;
public function __construct(EntityManagerInterface $entityManager, RuleBasedTagger $ruleBasedTagger, UserRepository $userRepository)
{
$this->entityManager = $entityManager;
$this->ruleBasedTagger = $ruleBasedTagger;
$this->userRepository = $userRepository;
public function __construct(
private EntityManagerInterface $entityManager,
private RuleBasedTagger $ruleBasedTagger,
private UserRepository $userRepository,
) {
parent::__construct();
}

View file

@ -15,15 +15,11 @@ class UpdatePicturesPathCommand extends Command
protected static $defaultName = 'wallabag:update-pictures-path';
protected static $defaultDescription = 'Update the path of the pictures for each entry when you changed your wallabag instance URL.';
private EntityManagerInterface $entityManager;
private EntryRepository $entryRepository;
private string $wallabagUrl;
public function __construct(EntityManagerInterface $entityManager, EntryRepository $entryRepository, $wallabagUrl)
{
$this->entityManager = $entityManager;
$this->entryRepository = $entryRepository;
$this->wallabagUrl = $wallabagUrl;
public function __construct(
private EntityManagerInterface $entityManager,
private EntryRepository $entryRepository,
private string $wallabagUrl,
) {
parent::__construct();
}