1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-06-27 16:36:00 +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

@ -8,11 +8,9 @@ use Wallabag\Entity\IgnoreOriginInstanceRule;
class IgnoreOriginInstanceRuleFixtures extends Fixture class IgnoreOriginInstanceRuleFixtures extends Fixture
{ {
private array $defaultIgnoreOriginInstanceRules; public function __construct(
private array $defaultIgnoreOriginInstanceRules,
public function __construct(array $defaultIgnoreOriginInstanceRules) ) {
{
$this->defaultIgnoreOriginInstanceRules = $defaultIgnoreOriginInstanceRules;
} }
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void

View file

@ -8,11 +8,9 @@ use Wallabag\Entity\InternalSetting;
class InternalSettingFixtures extends Fixture class InternalSettingFixtures extends Fixture
{ {
private array $defaultInternalSettings; public function __construct(
private array $defaultInternalSettings,
public function __construct(array $defaultInternalSettings) ) {
{
$this->defaultInternalSettings = $defaultInternalSettings;
} }
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void

View file

@ -11,11 +11,9 @@ use Wallabag\Helper\CryptoProxy;
class SiteCredentialFixtures extends Fixture implements DependentFixtureInterface class SiteCredentialFixtures extends Fixture implements DependentFixtureInterface
{ {
private CryptoProxy $cryptoProxy; public function __construct(
private CryptoProxy $cryptoProxy,
public function __construct(CryptoProxy $cryptoProxy) ) {
{
$this->cryptoProxy = $cryptoProxy;
} }
public function load(ObjectManager $manager): void public function load(ObjectManager $manager): void

View file

@ -3,6 +3,7 @@
declare(strict_types=1); declare(strict_types=1);
use Rector\Config\RectorConfig; use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
return RectorConfig::configure() return RectorConfig::configure()
->withPaths([ ->withPaths([
@ -14,5 +15,13 @@ return RectorConfig::configure()
]) ])
->withImportNames(importShortClasses: false) ->withImportNames(importShortClasses: false)
->withAttributesSets(doctrine: true) ->withAttributesSets(doctrine: true)
->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [
'inline_public' => true,
])
->withSkip([
ClassPropertyAssignToConstructorPromotionRector::class => [
__DIR__ . '/src/Entity/*',
],
])
->withPhpSets(php74: true) ->withPhpSets(php74: true)
->withTypeCoverageLevel(0); ->withTypeCoverageLevel(0);

View file

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

View file

@ -21,16 +21,12 @@ class CleanDuplicatesCommand extends Command
protected SymfonyStyle $io; protected SymfonyStyle $io;
protected int $duplicates = 0; 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(); parent::__construct();
} }

View file

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

View file

@ -19,16 +19,12 @@ class GenerateUrlHashesCommand extends Command
protected static $defaultDescription = 'Generates hashed urls for each entry'; protected static $defaultDescription = 'Generates hashed urls for each entry';
protected OutputInterface $output; 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(); parent::__construct();
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,18 +14,13 @@ use Wallabag\Repository\UserRepository;
abstract class AbstractConsumer abstract class AbstractConsumer
{ {
protected $em; public function __construct(
protected $userRepository; protected EntityManagerInterface $em,
protected $import; protected UserRepository $userRepository,
protected $eventDispatcher; protected AbstractImport $import,
protected $logger; protected EventDispatcherInterface $eventDispatcher,
protected ?LoggerInterface $logger = null,
public function __construct(EntityManagerInterface $em, UserRepository $userRepository, AbstractImport $import, EventDispatcherInterface $eventDispatcher, ?LoggerInterface $logger = null) ) {
{
$this->em = $em;
$this->userRepository = $userRepository;
$this->import = $import;
$this->eventDispatcher = $eventDispatcher;
$this->logger = $logger ?: new NullLogger(); $this->logger = $logger ?: new NullLogger();
} }
@ -74,9 +69,7 @@ abstract class AbstractConsumer
// entry saved, dispatch event about it! // entry saved, dispatch event about it!
$this->eventDispatcher->dispatch(new EntrySavedEvent($entry), EntrySavedEvent::NAME); $this->eventDispatcher->dispatch(new EntrySavedEvent($entry), EntrySavedEvent::NAME);
// clear only affected entities $this->em->clear();
$this->em->clear(Entry::class);
$this->em->clear(Tag::class);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->logger->warning('Unable to save entry', ['entry' => $storedEntry, 'exception' => $e]); $this->logger->warning('Unable to save entry', ['entry' => $storedEntry, 'exception' => $e]);

View file

@ -10,48 +10,21 @@ use OldSound\RabbitMqBundle\RabbitMq\Consumer;
*/ */
class RabbitMQConsumerTotalProxy class RabbitMQConsumerTotalProxy
{ {
private Consumer $pocketConsumer;
private Consumer $readabilityConsumer;
private Consumer $wallabagV1Consumer;
private Consumer $wallabagV2Consumer;
private Consumer $firefoxConsumer;
private Consumer $chromeConsumer;
private Consumer $instapaperConsumer;
private Consumer $pinboardConsumer;
private Consumer $deliciousConsumer;
private Consumer $elcuratorConsumer;
private Consumer $shaarliConsumer;
private Consumer $pocketHtmlConsumer;
private Consumer $omnivoreConsumer;
public function __construct( public function __construct(
Consumer $pocketConsumer, private Consumer $pocketConsumer,
Consumer $readabilityConsumer, private Consumer $readabilityConsumer,
Consumer $wallabagV1Consumer, private Consumer $wallabagV1Consumer,
Consumer $wallabagV2Consumer, private Consumer $wallabagV2Consumer,
Consumer $firefoxConsumer, private Consumer $firefoxConsumer,
Consumer $chromeConsumer, private Consumer $chromeConsumer,
Consumer $instapaperConsumer, private Consumer $instapaperConsumer,
Consumer $pinboardConsumer, private Consumer $pinboardConsumer,
Consumer $deliciousConsumer, private Consumer $deliciousConsumer,
Consumer $elcuratorConsumer, private Consumer $elcuratorConsumer,
Consumer $shaarliConsumer, private Consumer $shaarliConsumer,
Consumer $pocketHtmlConsumer, private Consumer $pocketHtmlConsumer,
Consumer $omnivoreConsumer, private Consumer $omnivoreConsumer,
) { ) {
$this->pocketConsumer = $pocketConsumer;
$this->readabilityConsumer = $readabilityConsumer;
$this->wallabagV1Consumer = $wallabagV1Consumer;
$this->wallabagV2Consumer = $wallabagV2Consumer;
$this->firefoxConsumer = $firefoxConsumer;
$this->chromeConsumer = $chromeConsumer;
$this->instapaperConsumer = $instapaperConsumer;
$this->pinboardConsumer = $pinboardConsumer;
$this->deliciousConsumer = $deliciousConsumer;
$this->elcuratorConsumer = $elcuratorConsumer;
$this->shaarliConsumer = $shaarliConsumer;
$this->pocketHtmlConsumer = $pocketHtmlConsumer;
$this->omnivoreConsumer = $omnivoreConsumer;
} }
/** /**

View file

@ -20,15 +20,11 @@ use Wallabag\Repository\AnnotationRepository;
class AnnotationController extends AbstractFOSRestController class AnnotationController extends AbstractFOSRestController
{ {
protected EntityManagerInterface $entityManager; public function __construct(
protected SerializerInterface $serializer; protected EntityManagerInterface $entityManager,
protected FormFactoryInterface $formFactory; protected SerializerInterface $serializer,
protected FormFactoryInterface $formFactory,
public function __construct(EntityManagerInterface $entityManager, SerializerInterface $serializer, FormFactoryInterface $formFactory) ) {
{
$this->entityManager = $entityManager;
$this->serializer = $serializer;
$this->formFactory = $formFactory;
} }
/** /**

View file

@ -21,21 +21,14 @@ use Wallabag\Entity\User;
class WallabagRestController extends AbstractFOSRestController class WallabagRestController extends AbstractFOSRestController
{ {
protected EntityManagerInterface $entityManager; public function __construct(
protected SerializerInterface $serializer; protected EntityManagerInterface $entityManager,
protected AuthorizationCheckerInterface $authorizationChecker; protected SerializerInterface $serializer,
protected TokenStorageInterface $tokenStorage; protected AuthorizationCheckerInterface $authorizationChecker,
protected TranslatorInterface $translator; protected TokenStorageInterface $tokenStorage,
protected bool $registrationEnabled; protected TranslatorInterface $translator,
protected bool $registrationEnabled,
public function __construct(EntityManagerInterface $entityManager, SerializerInterface $serializer, AuthorizationCheckerInterface $authorizationChecker, TokenStorageInterface $tokenStorage, TranslatorInterface $translator, bool $registrationEnabled) ) {
{
$this->entityManager = $entityManager;
$this->serializer = $serializer;
$this->authorizationChecker = $authorizationChecker;
$this->tokenStorage = $tokenStorage;
$this->translator = $translator;
$this->registrationEnabled = $registrationEnabled;
} }
/** /**

View file

@ -44,33 +44,16 @@ use Wallabag\Tools\Utils;
class ConfigController extends AbstractController class ConfigController extends AbstractController
{ {
private EntityManagerInterface $entityManager;
private UserManagerInterface $userManager;
private EntryRepository $entryRepository;
private TagRepository $tagRepository;
private AnnotationRepository $annotationRepository;
private ConfigRepository $configRepository;
private EventDispatcherInterface $eventDispatcher;
private Redirect $redirectHelper;
public function __construct( public function __construct(
EntityManagerInterface $entityManager, private EntityManagerInterface $entityManager,
UserManagerInterface $userManager, private UserManagerInterface $userManager,
EntryRepository $entryRepository, private EntryRepository $entryRepository,
TagRepository $tagRepository, private TagRepository $tagRepository,
AnnotationRepository $annotationRepository, private AnnotationRepository $annotationRepository,
ConfigRepository $configRepository, private ConfigRepository $configRepository,
EventDispatcherInterface $eventDispatcher, private EventDispatcherInterface $eventDispatcher,
Redirect $redirectHelper, private Redirect $redirectHelper,
) { ) {
$this->entityManager = $entityManager;
$this->userManager = $userManager;
$this->entryRepository = $entryRepository;
$this->tagRepository = $tagRepository;
$this->annotationRepository = $annotationRepository;
$this->configRepository = $configRepository;
$this->eventDispatcher = $eventDispatcher;
$this->redirectHelper = $redirectHelper;
} }
/** /**

View file

@ -33,25 +33,16 @@ use Wallabag\Repository\TagRepository;
class EntryController extends AbstractController class EntryController extends AbstractController
{ {
private EntityManagerInterface $entityManager; public function __construct(
private EventDispatcherInterface $eventDispatcher; private EntityManagerInterface $entityManager,
private EntryRepository $entryRepository; private EventDispatcherInterface $eventDispatcher,
private Redirect $redirectHelper; private EntryRepository $entryRepository,
private PreparePagerForEntries $preparePagerForEntriesHelper; private Redirect $redirectHelper,
private FilterBuilderUpdaterInterface $filterBuilderUpdater; private PreparePagerForEntries $preparePagerForEntriesHelper,
private ContentProxy $contentProxy; private FilterBuilderUpdaterInterface $filterBuilderUpdater,
private Security $security; private ContentProxy $contentProxy,
private Security $security,
public function __construct(EntityManagerInterface $entityManager, EventDispatcherInterface $eventDispatcher, EntryRepository $entryRepository, Redirect $redirectHelper, PreparePagerForEntries $preparePagerForEntriesHelper, FilterBuilderUpdaterInterface $filterBuilderUpdater, ContentProxy $contentProxy, Security $security) ) {
{
$this->entityManager = $entityManager;
$this->eventDispatcher = $eventDispatcher;
$this->entryRepository = $entryRepository;
$this->redirectHelper = $redirectHelper;
$this->preparePagerForEntriesHelper = $preparePagerForEntriesHelper;
$this->filterBuilderUpdater = $filterBuilderUpdater;
$this->contentProxy = $contentProxy;
$this->security = $security;
} }
/** /**

View file

@ -20,11 +20,9 @@ use Wallabag\Repository\EntryRepository;
class FeedController extends AbstractController class FeedController extends AbstractController
{ {
private EntryRepository $entryRepository; public function __construct(
private EntryRepository $entryRepository,
public function __construct(EntryRepository $entryRepository) ) {
{
$this->entryRepository = $entryRepository;
} }
/** /**

View file

@ -20,13 +20,10 @@ use Wallabag\Repository\IgnoreOriginInstanceRuleRepository;
*/ */
class IgnoreOriginInstanceRuleController extends AbstractController class IgnoreOriginInstanceRuleController extends AbstractController
{ {
private EntityManagerInterface $entityManager; public function __construct(
private TranslatorInterface $translator; private EntityManagerInterface $entityManager,
private TranslatorInterface $translator,
public function __construct(EntityManagerInterface $entityManager, TranslatorInterface $translator) ) {
{
$this->entityManager = $entityManager;
$this->translator = $translator;
} }
/** /**

View file

@ -13,17 +13,12 @@ use Wallabag\Redis\Producer as RedisProducer;
class ChromeController extends BrowserController class ChromeController extends BrowserController
{ {
private ChromeImport $chromeImport; public function __construct(
private Config $craueConfig; private ChromeImport $chromeImport,
private RabbitMqProducer $rabbitMqProducer; private Config $craueConfig,
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private RedisProducer $redisProducer,
public function __construct(ChromeImport $chromeImport, Config $craueConfig, RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer) ) {
{
$this->chromeImport = $chromeImport;
$this->craueConfig = $craueConfig;
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
} }
/** /**

View file

@ -15,13 +15,10 @@ use Wallabag\Redis\Producer as RedisProducer;
class DeliciousController extends AbstractController class DeliciousController extends AbstractController
{ {
private RabbitMqProducer $rabbitMqProducer; public function __construct(
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private RedisProducer $redisProducer,
public function __construct(RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer) ) {
{
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
} }
/** /**

View file

@ -13,17 +13,12 @@ use Wallabag\Redis\Producer as RedisProducer;
class ElcuratorController extends WallabagController class ElcuratorController extends WallabagController
{ {
private ElcuratorImport $elcuratorImport; public function __construct(
private Config $craueConfig; private ElcuratorImport $elcuratorImport,
private RabbitMqProducer $rabbitMqProducer; private Config $craueConfig,
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private RedisProducer $redisProducer,
public function __construct(ElcuratorImport $elcuratorImport, Config $craueConfig, RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer) ) {
{
$this->elcuratorImport = $elcuratorImport;
$this->craueConfig = $craueConfig;
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
} }
/** /**

View file

@ -13,17 +13,12 @@ use Wallabag\Redis\Producer as RedisProducer;
class FirefoxController extends BrowserController class FirefoxController extends BrowserController
{ {
private FirefoxImport $firefoxImport; public function __construct(
private Config $craueConfig; private FirefoxImport $firefoxImport,
private RabbitMqProducer $rabbitMqProducer; private Config $craueConfig,
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private RedisProducer $redisProducer,
public function __construct(FirefoxImport $firefoxImport, Config $craueConfig, RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer) ) {
{
$this->firefoxImport = $firefoxImport;
$this->craueConfig = $craueConfig;
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
} }
/** /**

View file

@ -13,13 +13,10 @@ use Wallabag\Import\ImportChain;
class ImportController extends AbstractController class ImportController extends AbstractController
{ {
private RabbitMQConsumerTotalProxy $rabbitMQConsumerTotalProxy; public function __construct(
private Client $redisClient; private RabbitMQConsumerTotalProxy $rabbitMQConsumerTotalProxy,
private Client $redisClient,
public function __construct(RabbitMQConsumerTotalProxy $rabbitMQConsumerTotalProxy, Client $redisClient) ) {
{
$this->rabbitMQConsumerTotalProxy = $rabbitMQConsumerTotalProxy;
$this->redisClient = $redisClient;
} }
/** /**

View file

@ -15,13 +15,10 @@ use Wallabag\Redis\Producer as RedisProducer;
class InstapaperController extends AbstractController class InstapaperController extends AbstractController
{ {
private RabbitMqProducer $rabbitMqProducer; public function __construct(
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private RedisProducer $redisProducer,
public function __construct(RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer) ) {
{
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
} }
/** /**

View file

@ -15,13 +15,10 @@ use Wallabag\Redis\Producer as RedisProducer;
class OmnivoreController extends AbstractController class OmnivoreController extends AbstractController
{ {
private RabbitMqProducer $rabbitMqProducer; public function __construct(
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private RedisProducer $redisProducer,
public function __construct(RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer) ) {
{
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
} }
/** /**

View file

@ -15,13 +15,10 @@ use Wallabag\Redis\Producer as RedisProducer;
class PinboardController extends AbstractController class PinboardController extends AbstractController
{ {
private RabbitMqProducer $rabbitMqProducer; public function __construct(
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private RedisProducer $redisProducer,
public function __construct(RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer) ) {
{
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
} }
/** /**

View file

@ -17,17 +17,12 @@ use Wallabag\Redis\Producer as RedisProducer;
class PocketController extends AbstractController class PocketController extends AbstractController
{ {
private Config $craueConfig; public function __construct(
private RabbitMqProducer $rabbitMqProducer; private Config $craueConfig,
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private SessionInterface $session; private RedisProducer $redisProducer,
private SessionInterface $session,
public function __construct(Config $craueConfig, RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer, SessionInterface $session) ) {
{
$this->craueConfig = $craueConfig;
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
$this->session = $session;
} }
/** /**

View file

@ -13,17 +13,12 @@ use Wallabag\Redis\Producer as RedisProducer;
class PocketHtmlController extends HtmlController class PocketHtmlController extends HtmlController
{ {
private PocketHtmlImport $pocketHtmlImport; public function __construct(
private Config $craueConfig; private PocketHtmlImport $pocketHtmlImport,
private RabbitMqProducer $rabbitMqProducer; private Config $craueConfig,
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private RedisProducer $redisProducer,
public function __construct(PocketHtmlImport $pocketHtmlImport, Config $craueConfig, RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer) ) {
{
$this->pocketHtmlImport = $pocketHtmlImport;
$this->craueConfig = $craueConfig;
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
} }
/** /**

View file

@ -15,13 +15,10 @@ use Wallabag\Redis\Producer as RedisProducer;
class ReadabilityController extends AbstractController class ReadabilityController extends AbstractController
{ {
private RabbitMqProducer $rabbitMqProducer; public function __construct(
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private RedisProducer $redisProducer,
public function __construct(RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer) ) {
{
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
} }
/** /**

View file

@ -13,17 +13,12 @@ use Wallabag\Redis\Producer as RedisProducer;
class ShaarliController extends HtmlController class ShaarliController extends HtmlController
{ {
private ShaarliImport $shaarliImport; public function __construct(
private Config $craueConfig; private ShaarliImport $shaarliImport,
private RabbitMqProducer $rabbitMqProducer; private Config $craueConfig,
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private RedisProducer $redisProducer,
public function __construct(ShaarliImport $shaarliImport, Config $craueConfig, RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer) ) {
{
$this->shaarliImport = $shaarliImport;
$this->craueConfig = $craueConfig;
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
} }
/** /**

View file

@ -13,17 +13,12 @@ use Wallabag\Redis\Producer as RedisProducer;
class WallabagV1Controller extends WallabagController class WallabagV1Controller extends WallabagController
{ {
private WallabagV1Import $wallabagImport; public function __construct(
private Config $craueConfig; private WallabagV1Import $wallabagImport,
private RabbitMqProducer $rabbitMqProducer; private Config $craueConfig,
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private RedisProducer $redisProducer,
public function __construct(WallabagV1Import $wallabagImport, Config $craueConfig, RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer) ) {
{
$this->wallabagImport = $wallabagImport;
$this->craueConfig = $craueConfig;
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
} }
/** /**

View file

@ -13,17 +13,12 @@ use Wallabag\Redis\Producer as RedisProducer;
class WallabagV2Controller extends WallabagController class WallabagV2Controller extends WallabagController
{ {
private WallabagV2Import $wallabagImport; public function __construct(
private Config $craueConfig; private WallabagV2Import $wallabagImport,
private RabbitMqProducer $rabbitMqProducer; private Config $craueConfig,
private RedisProducer $redisProducer; private RabbitMqProducer $rabbitMqProducer,
private RedisProducer $redisProducer,
public function __construct(WallabagV2Import $wallabagImport, Config $craueConfig, RabbitMqProducer $rabbitMqProducer, RedisProducer $redisProducer) ) {
{
$this->wallabagImport = $wallabagImport;
$this->craueConfig = $craueConfig;
$this->rabbitMqProducer = $rabbitMqProducer;
$this->redisProducer = $redisProducer;
} }
/** /**

View file

@ -23,17 +23,12 @@ use Wallabag\Repository\SiteCredentialRepository;
*/ */
class SiteCredentialController extends AbstractController class SiteCredentialController extends AbstractController
{ {
private EntityManagerInterface $entityManager; public function __construct(
private TranslatorInterface $translator; private EntityManagerInterface $entityManager,
private CryptoProxy $cryptoProxy; private TranslatorInterface $translator,
private Config $craueConfig; private CryptoProxy $cryptoProxy,
private Config $craueConfig,
public function __construct(EntityManagerInterface $entityManager, TranslatorInterface $translator, CryptoProxy $cryptoProxy, Config $craueConfig) ) {
{
$this->entityManager = $entityManager;
$this->translator = $translator;
$this->cryptoProxy = $cryptoProxy;
$this->craueConfig = $craueConfig;
} }
/** /**

View file

@ -25,17 +25,12 @@ use Wallabag\Repository\TagRepository;
class TagController extends AbstractController class TagController extends AbstractController
{ {
private EntityManagerInterface $entityManager; public function __construct(
private TagsAssigner $tagsAssigner; private EntityManagerInterface $entityManager,
private Redirect $redirectHelper; private TagsAssigner $tagsAssigner,
private Security $security; private Redirect $redirectHelper,
private Security $security,
public function __construct(EntityManagerInterface $entityManager, TagsAssigner $tagsAssigner, Redirect $redirectHelper, Security $security) ) {
{
$this->entityManager = $entityManager;
$this->tagsAssigner = $tagsAssigner;
$this->redirectHelper = $redirectHelper;
$this->security = $security;
} }
/** /**

View file

@ -29,13 +29,10 @@ use Wallabag\Repository\UserRepository;
*/ */
class UserController extends AbstractController class UserController extends AbstractController
{ {
private EntityManagerInterface $entityManager; public function __construct(
private TranslatorInterface $translator; private EntityManagerInterface $entityManager,
private TranslatorInterface $translator,
public function __construct(EntityManagerInterface $entityManager, TranslatorInterface $translator) ) {
{
$this->entityManager = $entityManager;
$this->translator = $translator;
} }
/** /**

View file

@ -10,17 +10,12 @@ use Doctrine\Migrations\Version\MigrationFactory;
*/ */
class MigrationFactoryDecorator implements MigrationFactory class MigrationFactoryDecorator implements MigrationFactory
{ {
private MigrationFactory $migrationFactory; public function __construct(
private string $tablePrefix; private MigrationFactory $migrationFactory,
private array $defaultIgnoreOriginInstanceRules; private string $tablePrefix,
private string $fetchingErrorMessage; private array $defaultIgnoreOriginInstanceRules,
private string $fetchingErrorMessage,
public function __construct(MigrationFactory $migrationFactory, string $tablePrefix, array $defaultIgnoreOriginInstanceRules, string $fetchingErrorMessage) ) {
{
$this->migrationFactory = $migrationFactory;
$this->tablePrefix = $tablePrefix;
$this->defaultIgnoreOriginInstanceRules = $defaultIgnoreOriginInstanceRules;
$this->fetchingErrorMessage = $fetchingErrorMessage;
} }
public function createVersion(string $migrationClassName): AbstractMigration public function createVersion(string $migrationClassName): AbstractMigration

View file

@ -12,11 +12,9 @@ class ConfigUpdatedEvent extends Event
{ {
public const NAME = 'config.updated'; public const NAME = 'config.updated';
protected $config; public function __construct(
protected Config $config,
public function __construct(Config $entry) ) {
{
$this->config = $entry;
} }
public function getConfig(): Config public function getConfig(): Config

View file

@ -12,11 +12,9 @@ class EntryDeletedEvent extends Event
{ {
public const NAME = 'entry.deleted'; public const NAME = 'entry.deleted';
protected $entry; public function __construct(
protected Entry $entry,
public function __construct(Entry $entry) ) {
{
$this->entry = $entry;
} }
public function getEntry(): Entry public function getEntry(): Entry

View file

@ -12,11 +12,9 @@ class EntrySavedEvent extends Event
{ {
public const NAME = 'entry.saved'; public const NAME = 'entry.saved';
protected $entry; public function __construct(
protected Entry $entry,
public function __construct(Entry $entry) ) {
{
$this->entry = $entry;
} }
public function getEntry(): Entry public function getEntry(): Entry

View file

@ -9,13 +9,10 @@ use Symfony\Component\Security\Http\Event\LoginFailureEvent;
class AuthenticationFailureListener implements EventSubscriberInterface class AuthenticationFailureListener implements EventSubscriberInterface
{ {
private $requestStack; public function __construct(
private $logger; private RequestStack $requestStack,
private LoggerInterface $logger,
public function __construct(RequestStack $requestStack, LoggerInterface $logger) ) {
{
$this->requestStack = $requestStack;
$this->logger = $logger;
} }
public static function getSubscribedEvents(): array public static function getSubscribedEvents(): array

View file

@ -15,27 +15,17 @@ use Wallabag\Entity\Config;
*/ */
class CreateConfigListener implements EventSubscriberInterface class CreateConfigListener implements EventSubscriberInterface
{ {
private $em; public function __construct(
private $itemsOnPage; private EntityManagerInterface $em,
private $feedLimit; private $itemsOnPage,
private $language; private $feedLimit,
private $readingSpeed; private $language,
private $actionMarkAsRead; private $readingSpeed,
private $listMode; private $actionMarkAsRead,
private $requestStack; private $listMode,
private $displayThumbnails; private $displayThumbnails,
private RequestStack $requestStack,
public function __construct(EntityManagerInterface $em, $itemsOnPage, $feedLimit, $language, $readingSpeed, $actionMarkAsRead, $listMode, $displayThumbnails, RequestStack $requestStack) ) {
{
$this->em = $em;
$this->itemsOnPage = $itemsOnPage;
$this->feedLimit = $feedLimit;
$this->language = $language;
$this->readingSpeed = $readingSpeed;
$this->actionMarkAsRead = $actionMarkAsRead;
$this->listMode = $listMode;
$this->requestStack = $requestStack;
$this->displayThumbnails = $displayThumbnails;
} }
public static function getSubscribedEvents(): array public static function getSubscribedEvents(): array

View file

@ -11,11 +11,9 @@ use Symfony\Component\HttpKernel\KernelEvents;
*/ */
class LocaleListener implements EventSubscriberInterface class LocaleListener implements EventSubscriberInterface
{ {
private $defaultLocale; public function __construct(
private $defaultLocale = 'en',
public function __construct($defaultLocale = 'en') ) {
{
$this->defaultLocale = $defaultLocale;
} }
public function onKernelRequest(RequestEvent $event) public function onKernelRequest(RequestEvent $event)

View file

@ -15,11 +15,9 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
*/ */
class PasswordResettingListener implements EventSubscriberInterface class PasswordResettingListener implements EventSubscriberInterface
{ {
private $router; public function __construct(
private UrlGeneratorInterface $router,
public function __construct(UrlGeneratorInterface $router) ) {
{
$this->router = $router;
} }
public static function getSubscribedEvents(): array public static function getSubscribedEvents(): array

View file

@ -11,19 +11,12 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class RegistrationListener implements EventSubscriberInterface class RegistrationListener implements EventSubscriberInterface
{ {
/** /**
* @var bool * @param bool $registrationEnabled
*/ */
private $registrationEnabled; public function __construct(
private $registrationEnabled,
/** private UrlGeneratorInterface $urlGenerator,
* @var UrlGeneratorInterface ) {
*/
private $urlGenerator;
public function __construct($registrationEnabled, UrlGeneratorInterface $urlGenerator)
{
$this->registrationEnabled = $registrationEnabled;
$this->urlGenerator = $urlGenerator;
} }
public static function getSubscribedEvents(): array public static function getSubscribedEvents(): array

View file

@ -16,11 +16,9 @@ use Wallabag\Entity\User;
*/ */
class UserLocaleListener class UserLocaleListener
{ {
private SessionInterface $session; public function __construct(
private SessionInterface $session,
public function __construct(SessionInterface $session) ) {
{
$this->session = $session;
} }
public function onInteractiveLogin(InteractiveLoginEvent $event) public function onInteractiveLogin(InteractiveLoginEvent $event)

View file

@ -12,17 +12,12 @@ use Wallabag\Helper\DownloadImages;
class DownloadImagesSubscriber implements EventSubscriberInterface class DownloadImagesSubscriber implements EventSubscriberInterface
{ {
private $em; public function __construct(
private $downloadImages; private EntityManagerInterface $em,
private $enabled; private DownloadImages $downloadImages,
private $logger; private $enabled,
private LoggerInterface $logger,
public function __construct(EntityManagerInterface $em, DownloadImages $downloadImages, $enabled, LoggerInterface $logger) ) {
{
$this->em = $em;
$this->downloadImages = $downloadImages;
$this->enabled = $enabled;
$this->logger = $logger;
} }
public static function getSubscribedEvents(): array public static function getSubscribedEvents(): array

View file

@ -9,13 +9,10 @@ use Wallabag\Event\ConfigUpdatedEvent;
class GenerateCustomCSSSubscriber implements EventSubscriberInterface class GenerateCustomCSSSubscriber implements EventSubscriberInterface
{ {
private $em; public function __construct(
private $compiler; private EntityManagerInterface $em,
private Compiler $compiler,
public function __construct(EntityManagerInterface $em, Compiler $compiler) ) {
{
$this->em = $em;
$this->compiler = $compiler;
} }
public static function getSubscribedEvents(): array public static function getSubscribedEvents(): array

View file

@ -17,11 +17,9 @@ use Wallabag\Entity\Entry;
*/ */
class SQLiteCascadeDeleteSubscriber implements EventSubscriber class SQLiteCascadeDeleteSubscriber implements EventSubscriber
{ {
private $doctrine; public function __construct(
private ManagerRegistry $doctrine,
public function __construct(ManagerRegistry $doctrine) ) {
{
$this->doctrine = $doctrine;
} }
/** /**

View file

@ -8,11 +8,9 @@ use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
class SchemaAdapterSubscriber implements EventSubscriber class SchemaAdapterSubscriber implements EventSubscriber
{ {
private string $databaseTablePrefix; public function __construct(
private string $databaseTablePrefix,
public function __construct(string $databaseTablePrefix) ) {
{
$this->databaseTablePrefix = $databaseTablePrefix;
} }
public function getSubscribedEvents(): array public function getSubscribedEvents(): array

View file

@ -9,11 +9,9 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
class AuthenticatorProvider implements ExpressionFunctionProviderInterface class AuthenticatorProvider implements ExpressionFunctionProviderInterface
{ {
private HttpClientInterface $requestHtmlFunctionClient; public function __construct(
private HttpClientInterface $requestHtmlFunctionClient,
public function __construct(HttpClientInterface $requestHtmlFunctionClient) ) {
{
$this->requestHtmlFunctionClient = $requestHtmlFunctionClient;
} }
public function getFunctions(): array public function getFunctions(): array

View file

@ -10,17 +10,12 @@ use Symfony\Component\Form\DataTransformerInterface;
*/ */
class StringToListTransformer implements DataTransformerInterface class StringToListTransformer implements DataTransformerInterface
{ {
/**
* @var string
*/
private $separator;
/** /**
* @param string $separator The separator used in the list * @param string $separator The separator used in the list
*/ */
public function __construct($separator = ',') public function __construct(
{ private $separator = ',',
$this->separator = $separator; ) {
} }
/** /**

View file

@ -14,17 +14,14 @@ use Wallabag\Entity\Config;
class ConfigType extends AbstractType class ConfigType extends AbstractType
{ {
private $languages = [];
private $fonts = [];
/** /**
* @param array $languages Languages come from configuration, array just code language as key and label as value * @param array $languages Languages come from configuration, array just code language as key and label as value
* @param array $fonts Fonts come from configuration, array just font name as key / value * @param array $fonts Fonts come from configuration, array just font name as key / value
*/ */
public function __construct($languages, $fonts) public function __construct(
{ private $languages,
$this->languages = $languages; private $fonts,
$this->fonts = $fonts; ) {
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)

View file

@ -21,16 +21,13 @@ use Wallabag\Repository\EntryRepository;
class EntryFilterType extends AbstractType class EntryFilterType extends AbstractType
{ {
private $repository;
private $tokenStorage;
/** /**
* Repository & user are used to get a list of language entries for this user. * Repository & user are used to get a list of language entries for this user.
*/ */
public function __construct(EntryRepository $entryRepository, TokenStorageInterface $tokenStorage) public function __construct(
{ private EntryRepository $repository,
$this->repository = $entryRepository; private TokenStorageInterface $tokenStorage,
$this->tokenStorage = $tokenStorage; ) {
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)

View file

@ -17,26 +17,19 @@ use Wallabag\Tools\Utils;
*/ */
class ContentProxy class ContentProxy
{ {
protected $graby;
protected $tagger;
protected $ignoreOriginProcessor;
protected $validator;
protected $logger;
protected $mimeTypes; protected $mimeTypes;
protected $fetchingErrorMessage;
protected $eventDispatcher; protected $eventDispatcher;
protected $storeArticleHeaders;
public function __construct(Graby $graby, RuleBasedTagger $tagger, RuleBasedIgnoreOriginProcessor $ignoreOriginProcessor, ValidatorInterface $validator, LoggerInterface $logger, $fetchingErrorMessage, $storeArticleHeaders = false) public function __construct(
{ protected Graby $graby,
$this->graby = $graby; protected RuleBasedTagger $tagger,
$this->tagger = $tagger; protected RuleBasedIgnoreOriginProcessor $ignoreOriginProcessor,
$this->ignoreOriginProcessor = $ignoreOriginProcessor; protected ValidatorInterface $validator,
$this->validator = $validator; protected LoggerInterface $logger,
$this->logger = $logger; protected $fetchingErrorMessage,
protected $storeArticleHeaders = false,
) {
$this->mimeTypes = new MimeTypes(); $this->mimeTypes = new MimeTypes();
$this->fetchingErrorMessage = $fetchingErrorMessage;
$this->storeArticleHeaders = $storeArticleHeaders;
} }
/** /**
@ -107,7 +100,9 @@ class ContentProxy
return; return;
} }
$this->logger->warning('Language validation failed. ' . (string) $errors); foreach ($errors as $error) {
$this->logger->warning('Language validation failed. ' . $error->getMessage());
}
} }
/** /**
@ -128,7 +123,9 @@ class ContentProxy
return; return;
} }
$this->logger->warning('PreviewPicture validation failed. ' . (string) $errors); foreach ($errors as $error) {
$this->logger->warning('PreviewPicture validation failed. ' . $error->getMessage());
}
} }
/** /**

View file

@ -13,13 +13,12 @@ use Psr\Log\LoggerInterface;
*/ */
class CryptoProxy class CryptoProxy
{ {
private $logger;
private $encryptionKey; private $encryptionKey;
public function __construct($encryptionKeyPath, LoggerInterface $logger) public function __construct(
{ $encryptionKeyPath,
$this->logger = $logger; private LoggerInterface $logger,
) {
if (!file_exists($encryptionKeyPath)) { if (!file_exists($encryptionKeyPath)) {
$key = Key::createNewRandomKey(); $key = Key::createNewRandomKey();

View file

@ -16,19 +16,16 @@ use Symfony\Contracts\HttpClient\ResponseInterface;
class DownloadImages class DownloadImages
{ {
public const REGENERATE_PICTURES_QUALITY = 80; public const REGENERATE_PICTURES_QUALITY = 80;
private $client;
private $baseFolder;
private $logger;
private $mimeTypes; private $mimeTypes;
private $wallabagUrl; private $wallabagUrl;
public function __construct(HttpClientInterface $downloadImagesClient, $baseFolder, $wallabagUrl, LoggerInterface $logger) public function __construct(
{ private HttpClientInterface $client,
$this->client = $downloadImagesClient; private $baseFolder,
$this->baseFolder = $baseFolder; $wallabagUrl,
private LoggerInterface $logger,
) {
$this->wallabagUrl = rtrim($wallabagUrl, '/'); $this->wallabagUrl = rtrim($wallabagUrl, '/');
$this->logger = $logger;
$this->mimeTypes = new MimeTypes(); $this->mimeTypes = new MimeTypes();
$this->setFolder(); $this->setFolder();

View file

@ -19,10 +19,6 @@ use Wallabag\Entity\User;
*/ */
class EntriesExport class EntriesExport
{ {
private $wallabagUrl;
private $logoPath;
private $translator;
private $tokenStorage;
private $title = ''; private $title = '';
private $entries = []; private $entries = [];
private $author = 'wallabag'; private $author = 'wallabag';
@ -34,12 +30,12 @@ class EntriesExport
* @param string $logoPath Path to the logo FROM THE BUNDLE SCOPE * @param string $logoPath Path to the logo FROM THE BUNDLE SCOPE
* @param TokenStorageInterface $tokenStorage Needed to retrieve the current user * @param TokenStorageInterface $tokenStorage Needed to retrieve the current user
*/ */
public function __construct(TranslatorInterface $translator, $wallabagUrl, $logoPath, TokenStorageInterface $tokenStorage) public function __construct(
{ private TranslatorInterface $translator,
$this->translator = $translator; private $wallabagUrl,
$this->wallabagUrl = $wallabagUrl; private $logoPath,
$this->logoPath = $logoPath; private TokenStorageInterface $tokenStorage,
$this->tokenStorage = $tokenStorage; ) {
} }
/** /**

View file

@ -10,11 +10,9 @@ use Wallabag\Entity\User;
class PreparePagerForEntries class PreparePagerForEntries
{ {
private $tokenStorage; public function __construct(
private TokenStorageInterface $tokenStorage,
public function __construct(TokenStorageInterface $tokenStorage) ) {
{
$this->tokenStorage = $tokenStorage;
} }
/** /**

View file

@ -13,13 +13,10 @@ use Wallabag\Entity\User;
*/ */
class Redirect class Redirect
{ {
private $router; public function __construct(
private $tokenStorage; private UrlGeneratorInterface $router,
private TokenStorageInterface $tokenStorage,
public function __construct(UrlGeneratorInterface $router, TokenStorageInterface $tokenStorage) ) {
{
$this->router = $router;
$this->tokenStorage = $tokenStorage;
} }
/** /**

View file

@ -9,15 +9,11 @@ use Wallabag\Repository\IgnoreOriginInstanceRuleRepository;
class RuleBasedIgnoreOriginProcessor class RuleBasedIgnoreOriginProcessor
{ {
protected $rulerz; public function __construct(
protected $logger; protected RulerZ $rulerz,
protected $ignoreOriginInstanceRuleRepository; protected LoggerInterface $logger,
protected IgnoreOriginInstanceRuleRepository $ignoreOriginInstanceRuleRepository,
public function __construct(RulerZ $rulerz, LoggerInterface $logger, IgnoreOriginInstanceRuleRepository $ignoreOriginInstanceRuleRepository) ) {
{
$this->rulerz = $rulerz;
$this->logger = $logger;
$this->ignoreOriginInstanceRuleRepository = $ignoreOriginInstanceRuleRepository;
} }
/** /**

View file

@ -14,17 +14,12 @@ use Wallabag\Repository\TagRepository;
class RuleBasedTagger class RuleBasedTagger
{ {
private $rulerz; public function __construct(
private $tagRepository; private RulerZ $rulerz,
private $entryRepository; private TagRepository $tagRepository,
private $logger; private EntryRepository $entryRepository,
private LoggerInterface $logger,
public function __construct(RulerZ $rulerz, TagRepository $tagRepository, EntryRepository $entryRepository, LoggerInterface $logger) ) {
{
$this->rulerz = $rulerz;
$this->tagRepository = $tagRepository;
$this->entryRepository = $entryRepository;
$this->logger = $logger;
} }
/** /**

View file

@ -8,14 +8,9 @@ use Wallabag\Repository\TagRepository;
class TagsAssigner class TagsAssigner
{ {
/** public function __construct(
* @var TagRepository protected TagRepository $tagRepository,
*/ ) {
protected $tagRepository;
public function __construct(TagRepository $tagRepository)
{
$this->tagRepository = $tagRepository;
} }
/** /**

View file

@ -14,19 +14,13 @@ use Wallabag\SiteConfig\SiteConfigBuilder;
class Authenticator implements LoggerAwareInterface class Authenticator implements LoggerAwareInterface
{ {
/** @var SiteConfigBuilder */
private $configBuilder;
/** @var LoginFormAuthenticator */
private $authenticator;
/** @var LoggerInterface */ /** @var LoggerInterface */
private $logger; private $logger;
public function __construct(SiteConfigBuilder $configBuilder, LoginFormAuthenticator $authenticator) public function __construct(
{ private SiteConfigBuilder $configBuilder,
$this->configBuilder = $configBuilder; private LoginFormAuthenticator $authenticator,
$this->authenticator = $authenticator; ) {
$this->logger = new NullLogger(); $this->logger = new NullLogger();
} }

View file

@ -11,19 +11,14 @@ use Symfony\Contracts\HttpClient\ResponseStreamInterface;
class WallabagClient implements HttpClientInterface class WallabagClient implements HttpClientInterface
{ {
private $restrictedAccess;
private HttpClientInterface $httpClient; private HttpClientInterface $httpClient;
private HttpBrowser $browser;
private Authenticator $authenticator;
private LoggerInterface $logger;
public function __construct($restrictedAccess, HttpBrowser $browser, Authenticator $authenticator, LoggerInterface $logger)
{
$this->restrictedAccess = $restrictedAccess;
$this->browser = $browser;
$this->authenticator = $authenticator;
$this->logger = $logger;
public function __construct(
private $restrictedAccess,
private HttpBrowser $browser,
private Authenticator $authenticator,
private LoggerInterface $logger,
) {
$this->httpClient = HttpClient::create([ $this->httpClient = HttpClient::create([
'timeout' => 10, 'timeout' => 10,
]); ]);

View file

@ -15,11 +15,6 @@ use Wallabag\Helper\TagsAssigner;
abstract class AbstractImport implements ImportInterface abstract class AbstractImport implements ImportInterface
{ {
protected $em;
protected $logger;
protected $contentProxy;
protected $tagsAssigner;
protected $eventDispatcher;
protected $producer; protected $producer;
protected $user; protected $user;
protected $markAsRead; protected $markAsRead;
@ -28,13 +23,13 @@ abstract class AbstractImport implements ImportInterface
protected $importedEntries = 0; protected $importedEntries = 0;
protected $queuedEntries = 0; protected $queuedEntries = 0;
public function __construct(EntityManagerInterface $em, ContentProxy $contentProxy, TagsAssigner $tagsAssigner, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger) public function __construct(
{ protected EntityManagerInterface $em,
$this->em = $em; protected ContentProxy $contentProxy,
$this->logger = $logger; protected TagsAssigner $tagsAssigner,
$this->contentProxy = $contentProxy; protected EventDispatcherInterface $eventDispatcher,
$this->tagsAssigner = $tagsAssigner; protected LoggerInterface $logger,
$this->eventDispatcher = $eventDispatcher; ) {
} }
public function setLogger(LoggerInterface $logger): void public function setLogger(LoggerInterface $logger): void
@ -178,9 +173,7 @@ abstract class AbstractImport implements ImportInterface
$entryToBeFlushed = []; $entryToBeFlushed = [];
// clear only affected entities $this->em->clear();
$this->em->clear(Entry::class);
$this->em->clear(Tag::class);
} }
++$i; ++$i;
} }

View file

@ -10,14 +10,15 @@ use Wallabag\Helper\TagsAssigner;
class WallabagV1Import extends WallabagImport class WallabagV1Import extends WallabagImport
{ {
protected $fetchingErrorMessage; public function __construct(
protected $fetchingErrorMessageTitle; EntityManagerInterface $em,
ContentProxy $contentProxy,
public function __construct(EntityManagerInterface $em, ContentProxy $contentProxy, TagsAssigner $tagsAssigner, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger, $fetchingErrorMessageTitle, $fetchingErrorMessage) TagsAssigner $tagsAssigner,
{ EventDispatcherInterface $eventDispatcher,
$this->fetchingErrorMessageTitle = $fetchingErrorMessageTitle; LoggerInterface $logger,
$this->fetchingErrorMessage = $fetchingErrorMessage; protected $fetchingErrorMessageTitle,
protected $fetchingErrorMessage,
) {
parent::__construct($em, $contentProxy, $tagsAssigner, $eventDispatcher, $logger); parent::__construct($em, $contentProxy, $tagsAssigner, $eventDispatcher, $logger);
} }

View file

@ -17,52 +17,17 @@ use Wallabag\Entity\User;
class AuthCodeMailer implements AuthCodeMailerInterface class AuthCodeMailer implements AuthCodeMailerInterface
{ {
/** /**
* Mailer. * @param string $senderEmail sender email address
* * @param string $senderName sender name
* @var MailerInterface * @param string $supportUrl support URL to report any bugs
*/ */
private $mailer; public function __construct(
private MailerInterface $mailer,
/** private Environment $twig,
* Twig to render the html's email. private $senderEmail,
* private $senderName,
* @var Environment private $supportUrl,
*/ ) {
private $twig;
/**
* Sender email address.
*
* @var string
*/
private $senderEmail;
/**
* Sender name.
*
* @var string
*/
private $senderName;
/**
* Support URL to report any bugs.
*
* @var string
*/
private $supportUrl;
/**
* @param string $senderEmail
* @param string $senderName
* @param string $supportUrl wallabag support url
*/
public function __construct(MailerInterface $mailer, Environment $twig, $senderEmail, $senderName, $supportUrl)
{
$this->mailer = $mailer;
$this->twig = $twig;
$this->senderEmail = $senderEmail;
$this->senderName = $senderName;
$this->supportUrl = $supportUrl;
} }
/** /**

View file

@ -18,14 +18,12 @@ use Wallabag\Repository\UserRepository;
*/ */
class UsernameFeedTokenConverter implements ParamConverterInterface class UsernameFeedTokenConverter implements ParamConverterInterface
{ {
private $registry;
/** /**
* @param ManagerRegistry $registry Manager registry * @param ManagerRegistry $registry Manager registry
*/ */
public function __construct(?ManagerRegistry $registry = null) public function __construct(
{ private ?ManagerRegistry $registry = null,
$this->registry = $registry; ) {
} }
/** /**

View file

@ -15,11 +15,9 @@ use Simpleue\Queue\RedisQueue;
*/ */
class Producer implements ProducerInterface class Producer implements ProducerInterface
{ {
private $queue; public function __construct(
private RedisQueue $queue,
public function __construct(RedisQueue $queue) ) {
{
$this->queue = $queue;
} }
/** /**

View file

@ -14,13 +14,11 @@ use Wallabag\Helper\CryptoProxy;
*/ */
class SiteCredentialRepository extends ServiceEntityRepository class SiteCredentialRepository extends ServiceEntityRepository
{ {
private $cryptoProxy; public function __construct(
ManagerRegistry $registry,
public function __construct(ManagerRegistry $registry, CryptoProxy $cryptoProxy) private CryptoProxy $cryptoProxy,
{ ) {
parent::__construct($registry, SiteCredential::class); parent::__construct($registry, SiteCredential::class);
$this->cryptoProxy = $cryptoProxy;
} }
/** /**

View file

@ -14,11 +14,9 @@ class AdminVoter extends Voter
public const LIST_IGNORE_ORIGIN_INSTANCE_RULES = 'LIST_IGNORE_ORIGIN_INSTANCE_RULES'; public const LIST_IGNORE_ORIGIN_INSTANCE_RULES = 'LIST_IGNORE_ORIGIN_INSTANCE_RULES';
public const CREATE_IGNORE_ORIGIN_INSTANCE_RULES = 'CREATE_IGNORE_ORIGIN_INSTANCE_RULES'; public const CREATE_IGNORE_ORIGIN_INSTANCE_RULES = 'CREATE_IGNORE_ORIGIN_INSTANCE_RULES';
private Security $security; public function __construct(
private Security $security,
public function __construct(Security $security) ) {
{
$this->security = $security;
} }
protected function supports(string $attribute, $subject): bool protected function supports(string $attribute, $subject): bool

View file

@ -12,11 +12,9 @@ class IgnoreOriginInstanceRuleVoter extends Voter
public const EDIT = 'EDIT'; public const EDIT = 'EDIT';
public const DELETE = 'DELETE'; public const DELETE = 'DELETE';
private Security $security; public function __construct(
private Security $security,
public function __construct(Security $security) ) {
{
$this->security = $security;
} }
protected function supports(string $attribute, $subject): bool protected function supports(string $attribute, $subject): bool

View file

@ -21,11 +21,9 @@ class MainVoter extends Voter
public const CREATE_SITE_CREDENTIALS = 'CREATE_SITE_CREDENTIALS'; public const CREATE_SITE_CREDENTIALS = 'CREATE_SITE_CREDENTIALS';
public const EDIT_CONFIG = 'EDIT_CONFIG'; public const EDIT_CONFIG = 'EDIT_CONFIG';
private Security $security; public function __construct(
private Security $security,
public function __construct(Security $security) ) {
{
$this->security = $security;
} }
protected function supports(string $attribute, $subject): bool protected function supports(string $attribute, $subject): bool

View file

@ -12,11 +12,9 @@ class UserVoter extends Voter
public const EDIT = 'EDIT'; public const EDIT = 'EDIT';
public const DELETE = 'DELETE'; public const DELETE = 'DELETE';
private Security $security; public function __construct(
private Security $security,
public function __construct(Security $security) ) {
{
$this->security = $security;
} }
protected function supports(string $attribute, $subject): bool protected function supports(string $attribute, $subject): bool

View file

@ -9,35 +9,15 @@ use Wallabag\Repository\SiteCredentialRepository;
class GrabySiteConfigBuilder implements SiteConfigBuilder class GrabySiteConfigBuilder implements SiteConfigBuilder
{ {
/**
* @var ConfigBuilder
*/
private $grabyConfigBuilder;
/**
* @var SiteCredentialRepository
*/
private $credentialRepository;
/**
* @var LoggerInterface
*/
private $logger;
/**
* @var TokenStorageInterface
*/
private $token;
/** /**
* GrabySiteConfigBuilder constructor. * GrabySiteConfigBuilder constructor.
*/ */
public function __construct(ConfigBuilder $grabyConfigBuilder, TokenStorageInterface $token, SiteCredentialRepository $credentialRepository, LoggerInterface $logger) public function __construct(
{ private ConfigBuilder $grabyConfigBuilder,
$this->grabyConfigBuilder = $grabyConfigBuilder; private TokenStorageInterface $token,
$this->credentialRepository = $credentialRepository; private SiteCredentialRepository $credentialRepository,
$this->logger = $logger; private LoggerInterface $logger,
$this->token = $token; ) {
} }
public function buildForHost($host) public function buildForHost($host)

View file

@ -9,12 +9,12 @@ use Wallabag\ExpressionLanguage\AuthenticatorProvider;
class LoginFormAuthenticator class LoginFormAuthenticator
{ {
private HttpBrowser $browser;
private ExpressionLanguage $expressionLanguage; private ExpressionLanguage $expressionLanguage;
public function __construct(HttpBrowser $browser, AuthenticatorProvider $authenticatorProvider) public function __construct(
{ private HttpBrowser $browser,
$this->browser = $browser; AuthenticatorProvider $authenticatorProvider,
) {
$this->expressionLanguage = new ExpressionLanguage(null, [$authenticatorProvider]); $this->expressionLanguage = new ExpressionLanguage(null, [$authenticatorProvider]);
} }

View file

@ -15,23 +15,15 @@ use Wallabag\Repository\TagRepository;
class WallabagExtension extends AbstractExtension implements GlobalsInterface class WallabagExtension extends AbstractExtension implements GlobalsInterface
{ {
private $tokenStorage; public function __construct(
private $entryRepository; private EntryRepository $entryRepository,
private $annotationRepository; private AnnotationRepository $annotationRepository,
private $tagRepository; private TagRepository $tagRepository,
private $lifeTime; private TokenStorageInterface $tokenStorage,
private $translator; private $lifeTime,
private $projectDir; private TranslatorInterface $translator,
private string $projectDir,
public function __construct(EntryRepository $entryRepository, AnnotationRepository $annotationRepository, TagRepository $tagRepository, TokenStorageInterface $tokenStorage, $lifeTime, TranslatorInterface $translator, string $projectDir) ) {
{
$this->entryRepository = $entryRepository;
$this->annotationRepository = $annotationRepository;
$this->tagRepository = $tagRepository;
$this->tokenStorage = $tokenStorage;
$this->lifeTime = $lifeTime;
$this->translator = $translator;
$this->projectDir = $projectDir;
} }
public function getGlobals(): array public function getGlobals(): array

View file

@ -25,7 +25,7 @@ class AMQPEntryConsumerTest extends TestCase
->method('flush'); ->method('flush');
$em $em
->expects($this->exactly(2)) ->expects($this->once())
->method('clear'); ->method('clear');
$body = <<<'JSON' $body = <<<'JSON'

View file

@ -24,7 +24,7 @@ class RedisEntryConsumerTest extends TestCase
->method('flush'); ->method('flush');
$em $em
->expects($this->exactly(2)) ->expects($this->once())
->method('clear'); ->method('clear');
$body = <<<'JSON' $body = <<<'JSON'