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

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

View file

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

View file

@ -44,33 +44,16 @@ use Wallabag\Tools\Utils;
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(
EntityManagerInterface $entityManager,
UserManagerInterface $userManager,
EntryRepository $entryRepository,
TagRepository $tagRepository,
AnnotationRepository $annotationRepository,
ConfigRepository $configRepository,
EventDispatcherInterface $eventDispatcher,
Redirect $redirectHelper,
private EntityManagerInterface $entityManager,
private UserManagerInterface $userManager,
private EntryRepository $entryRepository,
private TagRepository $tagRepository,
private AnnotationRepository $annotationRepository,
private ConfigRepository $configRepository,
private EventDispatcherInterface $eventDispatcher,
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
{
private EntityManagerInterface $entityManager;
private EventDispatcherInterface $eventDispatcher;
private EntryRepository $entryRepository;
private Redirect $redirectHelper;
private PreparePagerForEntries $preparePagerForEntriesHelper;
private FilterBuilderUpdaterInterface $filterBuilderUpdater;
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;
public function __construct(
private EntityManagerInterface $entityManager,
private EventDispatcherInterface $eventDispatcher,
private EntryRepository $entryRepository,
private Redirect $redirectHelper,
private PreparePagerForEntries $preparePagerForEntriesHelper,
private FilterBuilderUpdaterInterface $filterBuilderUpdater,
private ContentProxy $contentProxy,
private Security $security,
) {
}
/**

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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