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
{
private array $defaultIgnoreOriginInstanceRules;
public function __construct(array $defaultIgnoreOriginInstanceRules)
{
$this->defaultIgnoreOriginInstanceRules = $defaultIgnoreOriginInstanceRules;
public function __construct(
private array $defaultIgnoreOriginInstanceRules,
) {
}
public function load(ObjectManager $manager): void

View file

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

View file

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

View file

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

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();
}

View file

@ -14,18 +14,13 @@ use Wallabag\Repository\UserRepository;
abstract class AbstractConsumer
{
protected $em;
protected $userRepository;
protected $import;
protected $eventDispatcher;
protected $logger;
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;
public function __construct(
protected EntityManagerInterface $em,
protected UserRepository $userRepository,
protected AbstractImport $import,
protected EventDispatcherInterface $eventDispatcher,
protected ?LoggerInterface $logger = null,
) {
$this->logger = $logger ?: new NullLogger();
}
@ -74,9 +69,7 @@ abstract class AbstractConsumer
// entry saved, dispatch event about it!
$this->eventDispatcher->dispatch(new EntrySavedEvent($entry), EntrySavedEvent::NAME);
// clear only affected entities
$this->em->clear(Entry::class);
$this->em->clear(Tag::class);
$this->em->clear();
} catch (\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
{
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(
Consumer $pocketConsumer,
Consumer $readabilityConsumer,
Consumer $wallabagV1Consumer,
Consumer $wallabagV2Consumer,
Consumer $firefoxConsumer,
Consumer $chromeConsumer,
Consumer $instapaperConsumer,
Consumer $pinboardConsumer,
Consumer $deliciousConsumer,
Consumer $elcuratorConsumer,
Consumer $shaarliConsumer,
Consumer $pocketHtmlConsumer,
Consumer $omnivoreConsumer,
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,
) {
$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
{
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,
) {
}
/**

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,17 +14,14 @@ use Wallabag\Entity\Config;
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 $fonts Fonts come from configuration, array just font name as key / value
*/
public function __construct($languages, $fonts)
{
$this->languages = $languages;
$this->fonts = $fonts;
public function __construct(
private $languages,
private $fonts,
) {
}
public function buildForm(FormBuilderInterface $builder, array $options)

View file

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

View file

@ -17,26 +17,19 @@ use Wallabag\Tools\Utils;
*/
class ContentProxy
{
protected $graby;
protected $tagger;
protected $ignoreOriginProcessor;
protected $validator;
protected $logger;
protected $mimeTypes;
protected $fetchingErrorMessage;
protected $eventDispatcher;
protected $storeArticleHeaders;
public function __construct(Graby $graby, RuleBasedTagger $tagger, RuleBasedIgnoreOriginProcessor $ignoreOriginProcessor, ValidatorInterface $validator, LoggerInterface $logger, $fetchingErrorMessage, $storeArticleHeaders = false)
{
$this->graby = $graby;
$this->tagger = $tagger;
$this->ignoreOriginProcessor = $ignoreOriginProcessor;
$this->validator = $validator;
$this->logger = $logger;
public function __construct(
protected Graby $graby,
protected RuleBasedTagger $tagger,
protected RuleBasedIgnoreOriginProcessor $ignoreOriginProcessor,
protected ValidatorInterface $validator,
protected LoggerInterface $logger,
protected $fetchingErrorMessage,
protected $storeArticleHeaders = false,
) {
$this->mimeTypes = new MimeTypes();
$this->fetchingErrorMessage = $fetchingErrorMessage;
$this->storeArticleHeaders = $storeArticleHeaders;
}
/**
@ -107,7 +100,9 @@ class ContentProxy
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;
}
$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
{
private $logger;
private $encryptionKey;
public function __construct($encryptionKeyPath, LoggerInterface $logger)
{
$this->logger = $logger;
public function __construct(
$encryptionKeyPath,
private LoggerInterface $logger,
) {
if (!file_exists($encryptionKeyPath)) {
$key = Key::createNewRandomKey();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,19 +11,14 @@ use Symfony\Contracts\HttpClient\ResponseStreamInterface;
class WallabagClient implements HttpClientInterface
{
private $restrictedAccess;
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([
'timeout' => 10,
]);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,13 +14,11 @@ use Wallabag\Helper\CryptoProxy;
*/
class SiteCredentialRepository extends ServiceEntityRepository
{
private $cryptoProxy;
public function __construct(ManagerRegistry $registry, CryptoProxy $cryptoProxy)
{
public function __construct(
ManagerRegistry $registry,
private CryptoProxy $cryptoProxy,
) {
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 CREATE_IGNORE_ORIGIN_INSTANCE_RULES = 'CREATE_IGNORE_ORIGIN_INSTANCE_RULES';
private Security $security;
public function __construct(Security $security)
{
$this->security = $security;
public function __construct(
private Security $security,
) {
}
protected function supports(string $attribute, $subject): bool

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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