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

@ -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