diff --git a/fixtures/IgnoreOriginInstanceRuleFixtures.php b/fixtures/IgnoreOriginInstanceRuleFixtures.php index d4a3da1c6..f425a0f1f 100644 --- a/fixtures/IgnoreOriginInstanceRuleFixtures.php +++ b/fixtures/IgnoreOriginInstanceRuleFixtures.php @@ -9,7 +9,7 @@ use Wallabag\Entity\IgnoreOriginInstanceRule; class IgnoreOriginInstanceRuleFixtures extends Fixture { public function __construct( - private array $defaultIgnoreOriginInstanceRules, + private readonly array $defaultIgnoreOriginInstanceRules, ) { } diff --git a/fixtures/InternalSettingFixtures.php b/fixtures/InternalSettingFixtures.php index cd81a5e98..1ca6d79cd 100644 --- a/fixtures/InternalSettingFixtures.php +++ b/fixtures/InternalSettingFixtures.php @@ -9,7 +9,7 @@ use Wallabag\Entity\InternalSetting; class InternalSettingFixtures extends Fixture { public function __construct( - private array $defaultInternalSettings, + private readonly array $defaultInternalSettings, ) { } diff --git a/fixtures/SiteCredentialFixtures.php b/fixtures/SiteCredentialFixtures.php index c6a089757..2657d9cec 100644 --- a/fixtures/SiteCredentialFixtures.php +++ b/fixtures/SiteCredentialFixtures.php @@ -12,7 +12,7 @@ use Wallabag\Helper\CryptoProxy; class SiteCredentialFixtures extends Fixture implements DependentFixtureInterface { public function __construct( - private CryptoProxy $cryptoProxy, + private readonly CryptoProxy $cryptoProxy, ) { } diff --git a/rector.php b/rector.php index 7480ccf1c..0b8e5af6e 100644 --- a/rector.php +++ b/rector.php @@ -4,6 +4,7 @@ declare(strict_types=1); use Rector\Config\RectorConfig; use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector; +use Rector\Php81\Rector\Property\ReadOnlyPropertyRector; return RectorConfig::configure() ->withPaths([ @@ -18,6 +19,9 @@ return RectorConfig::configure() ->withConfiguredRule(ClassPropertyAssignToConstructorPromotionRector::class, [ 'inline_public' => true, ]) + ->withRules([ + ReadOnlyPropertyRector::class, + ]) ->withSkip([ ClassPropertyAssignToConstructorPromotionRector::class => [ __DIR__ . '/src/Entity/*', diff --git a/src/Command/CleanDownloadedImagesCommand.php b/src/Command/CleanDownloadedImagesCommand.php index fdbe09166..b35825828 100644 --- a/src/Command/CleanDownloadedImagesCommand.php +++ b/src/Command/CleanDownloadedImagesCommand.php @@ -17,8 +17,8 @@ class CleanDownloadedImagesCommand extends Command protected static $defaultDescription = 'Cleans downloaded images which are no more associated to an entry'; public function __construct( - private EntryRepository $entryRepository, - private DownloadImages $downloadImages, + private readonly EntryRepository $entryRepository, + private readonly DownloadImages $downloadImages, ) { parent::__construct(); } diff --git a/src/Command/CleanDuplicatesCommand.php b/src/Command/CleanDuplicatesCommand.php index 100c5b9e6..73e272961 100644 --- a/src/Command/CleanDuplicatesCommand.php +++ b/src/Command/CleanDuplicatesCommand.php @@ -23,9 +23,9 @@ class CleanDuplicatesCommand extends Command protected int $duplicates = 0; public function __construct( - private EntityManagerInterface $entityManager, - private EntryRepository $entryRepository, - private UserRepository $userRepository, + private readonly EntityManagerInterface $entityManager, + private readonly EntryRepository $entryRepository, + private readonly UserRepository $userRepository, ) { parent::__construct(); } diff --git a/src/Command/ExportCommand.php b/src/Command/ExportCommand.php index 399f74d99..85fc85991 100644 --- a/src/Command/ExportCommand.php +++ b/src/Command/ExportCommand.php @@ -18,10 +18,10 @@ class ExportCommand extends Command protected static $defaultDescription = 'Export all entries for an user'; public function __construct( - private EntryRepository $entryRepository, - private UserRepository $userRepository, - private EntriesExport $entriesExport, - private string $projectDir, + private readonly EntryRepository $entryRepository, + private readonly UserRepository $userRepository, + private readonly EntriesExport $entriesExport, + private readonly string $projectDir, ) { parent::__construct(); } diff --git a/src/Command/GenerateUrlHashesCommand.php b/src/Command/GenerateUrlHashesCommand.php index 82a8574c6..df50fd164 100644 --- a/src/Command/GenerateUrlHashesCommand.php +++ b/src/Command/GenerateUrlHashesCommand.php @@ -21,9 +21,9 @@ class GenerateUrlHashesCommand extends Command protected OutputInterface $output; public function __construct( - private EntityManagerInterface $entityManager, - private EntryRepository $entryRepository, - private UserRepository $userRepository, + private readonly EntityManagerInterface $entityManager, + private readonly EntryRepository $entryRepository, + private readonly UserRepository $userRepository, ) { parent::__construct(); } diff --git a/src/Command/Import/ImportCommand.php b/src/Command/Import/ImportCommand.php index e3bff092c..2f5b6ba18 100644 --- a/src/Command/Import/ImportCommand.php +++ b/src/Command/Import/ImportCommand.php @@ -34,21 +34,21 @@ class ImportCommand extends Command protected static $defaultDescription = 'Import entries from a JSON export'; public function __construct( - 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, + private readonly EntityManagerInterface $entityManager, + private readonly TokenStorageInterface $tokenStorage, + private readonly UserRepository $userRepository, + private readonly WallabagV2Import $wallabagV2Import, + private readonly FirefoxImport $firefoxImport, + private readonly ChromeImport $chromeImport, + private readonly ReadabilityImport $readabilityImport, + private readonly InstapaperImport $instapaperImport, + private readonly PinboardImport $pinboardImport, + private readonly DeliciousImport $deliciousImport, + private readonly WallabagV1Import $wallabagV1Import, + private readonly ElcuratorImport $elcuratorImport, + private readonly ShaarliImport $shaarliImport, + private readonly PocketHtmlImport $pocketHtmlImport, + private readonly OmnivoreImport $omnivoreImport, ) { parent::__construct(); } diff --git a/src/Command/Import/RedisWorkerCommand.php b/src/Command/Import/RedisWorkerCommand.php index bb614b48f..266863be2 100644 --- a/src/Command/Import/RedisWorkerCommand.php +++ b/src/Command/Import/RedisWorkerCommand.php @@ -17,7 +17,7 @@ class RedisWorkerCommand extends Command protected static $defaultDescription = 'Launch Redis worker'; public function __construct( - private ContainerInterface $container, + private readonly ContainerInterface $container, ) { parent::__construct(); } diff --git a/src/Command/InstallCommand.php b/src/Command/InstallCommand.php index 66a1cc1fe..fd6802b0c 100644 --- a/src/Command/InstallCommand.php +++ b/src/Command/InstallCommand.php @@ -38,13 +38,13 @@ class InstallCommand extends Command ]; public function __construct( - private EntityManagerInterface $entityManager, - private EventDispatcherInterface $dispatcher, - private UserManagerInterface $userManager, - private TableMetadataStorageConfiguration $tableMetadataStorageConfiguration, - private string $databaseDriver, - private array $defaultSettings, - private array $defaultIgnoreOriginInstanceRules, + private readonly EntityManagerInterface $entityManager, + private readonly EventDispatcherInterface $dispatcher, + private readonly UserManagerInterface $userManager, + private readonly TableMetadataStorageConfiguration $tableMetadataStorageConfiguration, + private readonly string $databaseDriver, + private readonly array $defaultSettings, + private readonly array $defaultIgnoreOriginInstanceRules, ) { parent::__construct(); } diff --git a/src/Command/ListUserCommand.php b/src/Command/ListUserCommand.php index 28dac48b1..b76e059d3 100644 --- a/src/Command/ListUserCommand.php +++ b/src/Command/ListUserCommand.php @@ -16,7 +16,7 @@ class ListUserCommand extends Command protected static $defaultDescription = 'List all users'; public function __construct( - private UserRepository $userRepository, + private readonly UserRepository $userRepository, ) { parent::__construct(); } diff --git a/src/Command/ReloadEntryCommand.php b/src/Command/ReloadEntryCommand.php index 7bfbaef3c..2ba48d2fe 100644 --- a/src/Command/ReloadEntryCommand.php +++ b/src/Command/ReloadEntryCommand.php @@ -22,11 +22,11 @@ class ReloadEntryCommand extends Command protected static $defaultDescription = 'Reload entries'; public function __construct( - private EntryRepository $entryRepository, - private UserRepository $userRepository, - private EntityManagerInterface $entityManager, - private ContentProxy $contentProxy, - private EventDispatcherInterface $dispatcher, + private readonly EntryRepository $entryRepository, + private readonly UserRepository $userRepository, + private readonly EntityManagerInterface $entityManager, + private readonly ContentProxy $contentProxy, + private readonly EventDispatcherInterface $dispatcher, ) { parent::__construct(); } diff --git a/src/Command/ShowUserCommand.php b/src/Command/ShowUserCommand.php index f1b68c4cd..ad03c63bc 100644 --- a/src/Command/ShowUserCommand.php +++ b/src/Command/ShowUserCommand.php @@ -19,7 +19,7 @@ class ShowUserCommand extends Command protected SymfonyStyle $io; public function __construct( - private UserRepository $userRepository, + private readonly UserRepository $userRepository, ) { parent::__construct(); } diff --git a/src/Command/TagAllCommand.php b/src/Command/TagAllCommand.php index 99fcf32ba..4a0fa0905 100644 --- a/src/Command/TagAllCommand.php +++ b/src/Command/TagAllCommand.php @@ -19,9 +19,9 @@ class TagAllCommand extends Command protected static $defaultDescription = 'Tag all entries using the tagging rules.'; public function __construct( - private EntityManagerInterface $entityManager, - private RuleBasedTagger $ruleBasedTagger, - private UserRepository $userRepository, + private readonly EntityManagerInterface $entityManager, + private readonly RuleBasedTagger $ruleBasedTagger, + private readonly UserRepository $userRepository, ) { parent::__construct(); } diff --git a/src/Command/UpdatePicturesPathCommand.php b/src/Command/UpdatePicturesPathCommand.php index aff65bc33..40f144369 100644 --- a/src/Command/UpdatePicturesPathCommand.php +++ b/src/Command/UpdatePicturesPathCommand.php @@ -16,9 +16,9 @@ class UpdatePicturesPathCommand extends Command protected static $defaultDescription = 'Update the path of the pictures for each entry when you changed your wallabag instance URL.'; public function __construct( - private EntityManagerInterface $entityManager, - private EntryRepository $entryRepository, - private string $wallabagUrl, + private readonly EntityManagerInterface $entityManager, + private readonly EntryRepository $entryRepository, + private readonly string $wallabagUrl, ) { parent::__construct(); } diff --git a/src/Consumer/RabbitMQConsumerTotalProxy.php b/src/Consumer/RabbitMQConsumerTotalProxy.php index 7906ac5d8..b32a0653a 100644 --- a/src/Consumer/RabbitMQConsumerTotalProxy.php +++ b/src/Consumer/RabbitMQConsumerTotalProxy.php @@ -11,19 +11,19 @@ use OldSound\RabbitMqBundle\RabbitMq\Consumer; class RabbitMQConsumerTotalProxy { public function __construct( - 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, + private readonly Consumer $pocketConsumer, + private readonly Consumer $readabilityConsumer, + private readonly Consumer $wallabagV1Consumer, + private readonly Consumer $wallabagV2Consumer, + private readonly Consumer $firefoxConsumer, + private readonly Consumer $chromeConsumer, + private readonly Consumer $instapaperConsumer, + private readonly Consumer $pinboardConsumer, + private readonly Consumer $deliciousConsumer, + private readonly Consumer $elcuratorConsumer, + private readonly Consumer $shaarliConsumer, + private readonly Consumer $pocketHtmlConsumer, + private readonly Consumer $omnivoreConsumer, ) { } diff --git a/src/Controller/ConfigController.php b/src/Controller/ConfigController.php index d3776d996..0d3e344d4 100644 --- a/src/Controller/ConfigController.php +++ b/src/Controller/ConfigController.php @@ -45,14 +45,14 @@ use Wallabag\Tools\Utils; class ConfigController extends AbstractController { public function __construct( - private EntityManagerInterface $entityManager, - private UserManagerInterface $userManager, - private EntryRepository $entryRepository, - private TagRepository $tagRepository, - private AnnotationRepository $annotationRepository, - private ConfigRepository $configRepository, - private EventDispatcherInterface $eventDispatcher, - private Redirect $redirectHelper, + private readonly EntityManagerInterface $entityManager, + private readonly UserManagerInterface $userManager, + private readonly EntryRepository $entryRepository, + private readonly TagRepository $tagRepository, + private readonly AnnotationRepository $annotationRepository, + private readonly ConfigRepository $configRepository, + private readonly EventDispatcherInterface $eventDispatcher, + private readonly Redirect $redirectHelper, ) { } diff --git a/src/Controller/EntryController.php b/src/Controller/EntryController.php index 84ba851f8..c5c25289b 100644 --- a/src/Controller/EntryController.php +++ b/src/Controller/EntryController.php @@ -34,14 +34,14 @@ use Wallabag\Repository\TagRepository; class EntryController extends AbstractController { 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, + private readonly EntityManagerInterface $entityManager, + private readonly EventDispatcherInterface $eventDispatcher, + private readonly EntryRepository $entryRepository, + private readonly Redirect $redirectHelper, + private readonly PreparePagerForEntries $preparePagerForEntriesHelper, + private readonly FilterBuilderUpdaterInterface $filterBuilderUpdater, + private readonly ContentProxy $contentProxy, + private readonly Security $security, ) { } diff --git a/src/Controller/FeedController.php b/src/Controller/FeedController.php index c643052a8..8756f0fbd 100644 --- a/src/Controller/FeedController.php +++ b/src/Controller/FeedController.php @@ -21,7 +21,7 @@ use Wallabag\Repository\EntryRepository; class FeedController extends AbstractController { public function __construct( - private EntryRepository $entryRepository, + private readonly EntryRepository $entryRepository, ) { } diff --git a/src/Controller/IgnoreOriginInstanceRuleController.php b/src/Controller/IgnoreOriginInstanceRuleController.php index 6b4d3c2d6..39029311c 100644 --- a/src/Controller/IgnoreOriginInstanceRuleController.php +++ b/src/Controller/IgnoreOriginInstanceRuleController.php @@ -21,8 +21,8 @@ use Wallabag\Repository\IgnoreOriginInstanceRuleRepository; class IgnoreOriginInstanceRuleController extends AbstractController { public function __construct( - private EntityManagerInterface $entityManager, - private TranslatorInterface $translator, + private readonly EntityManagerInterface $entityManager, + private readonly TranslatorInterface $translator, ) { } diff --git a/src/Controller/Import/ChromeController.php b/src/Controller/Import/ChromeController.php index 7feb2714e..b579d6196 100644 --- a/src/Controller/Import/ChromeController.php +++ b/src/Controller/Import/ChromeController.php @@ -14,10 +14,10 @@ use Wallabag\Redis\Producer as RedisProducer; class ChromeController extends BrowserController { public function __construct( - private ChromeImport $chromeImport, - private Config $craueConfig, - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, + private readonly ChromeImport $chromeImport, + private readonly Config $craueConfig, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, ) { } diff --git a/src/Controller/Import/DeliciousController.php b/src/Controller/Import/DeliciousController.php index 4d110398f..20fb5d892 100644 --- a/src/Controller/Import/DeliciousController.php +++ b/src/Controller/Import/DeliciousController.php @@ -16,8 +16,8 @@ use Wallabag\Redis\Producer as RedisProducer; class DeliciousController extends AbstractController { public function __construct( - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, ) { } diff --git a/src/Controller/Import/ElcuratorController.php b/src/Controller/Import/ElcuratorController.php index f5cc28162..595fa20b0 100644 --- a/src/Controller/Import/ElcuratorController.php +++ b/src/Controller/Import/ElcuratorController.php @@ -14,10 +14,10 @@ use Wallabag\Redis\Producer as RedisProducer; class ElcuratorController extends WallabagController { public function __construct( - private ElcuratorImport $elcuratorImport, - private Config $craueConfig, - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, + private readonly ElcuratorImport $elcuratorImport, + private readonly Config $craueConfig, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, ) { } diff --git a/src/Controller/Import/FirefoxController.php b/src/Controller/Import/FirefoxController.php index c3891ae2f..c65447c44 100644 --- a/src/Controller/Import/FirefoxController.php +++ b/src/Controller/Import/FirefoxController.php @@ -14,10 +14,10 @@ use Wallabag\Redis\Producer as RedisProducer; class FirefoxController extends BrowserController { public function __construct( - private FirefoxImport $firefoxImport, - private Config $craueConfig, - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, + private readonly FirefoxImport $firefoxImport, + private readonly Config $craueConfig, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, ) { } diff --git a/src/Controller/Import/ImportController.php b/src/Controller/Import/ImportController.php index 17a72a567..dbdbd6377 100644 --- a/src/Controller/Import/ImportController.php +++ b/src/Controller/Import/ImportController.php @@ -14,8 +14,8 @@ use Wallabag\Import\ImportChain; class ImportController extends AbstractController { public function __construct( - private RabbitMQConsumerTotalProxy $rabbitMQConsumerTotalProxy, - private Client $redisClient, + private readonly RabbitMQConsumerTotalProxy $rabbitMQConsumerTotalProxy, + private readonly Client $redisClient, ) { } diff --git a/src/Controller/Import/InstapaperController.php b/src/Controller/Import/InstapaperController.php index c764e8457..88a62c1e7 100644 --- a/src/Controller/Import/InstapaperController.php +++ b/src/Controller/Import/InstapaperController.php @@ -16,8 +16,8 @@ use Wallabag\Redis\Producer as RedisProducer; class InstapaperController extends AbstractController { public function __construct( - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, ) { } diff --git a/src/Controller/Import/OmnivoreController.php b/src/Controller/Import/OmnivoreController.php index ae41f6c98..3101a99fe 100644 --- a/src/Controller/Import/OmnivoreController.php +++ b/src/Controller/Import/OmnivoreController.php @@ -16,8 +16,8 @@ use Wallabag\Redis\Producer as RedisProducer; class OmnivoreController extends AbstractController { public function __construct( - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, ) { } diff --git a/src/Controller/Import/PinboardController.php b/src/Controller/Import/PinboardController.php index 2fa3381a6..1ac75bd75 100644 --- a/src/Controller/Import/PinboardController.php +++ b/src/Controller/Import/PinboardController.php @@ -16,8 +16,8 @@ use Wallabag\Redis\Producer as RedisProducer; class PinboardController extends AbstractController { public function __construct( - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, ) { } diff --git a/src/Controller/Import/PocketController.php b/src/Controller/Import/PocketController.php index 0197ef4dd..7cd0ec06c 100644 --- a/src/Controller/Import/PocketController.php +++ b/src/Controller/Import/PocketController.php @@ -18,10 +18,10 @@ use Wallabag\Redis\Producer as RedisProducer; class PocketController extends AbstractController { public function __construct( - private Config $craueConfig, - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, - private SessionInterface $session, + private readonly Config $craueConfig, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, + private readonly SessionInterface $session, ) { } diff --git a/src/Controller/Import/PocketHtmlController.php b/src/Controller/Import/PocketHtmlController.php index fa0ecee67..1f9db0b06 100644 --- a/src/Controller/Import/PocketHtmlController.php +++ b/src/Controller/Import/PocketHtmlController.php @@ -14,10 +14,10 @@ use Wallabag\Redis\Producer as RedisProducer; class PocketHtmlController extends HtmlController { public function __construct( - private PocketHtmlImport $pocketHtmlImport, - private Config $craueConfig, - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, + private readonly PocketHtmlImport $pocketHtmlImport, + private readonly Config $craueConfig, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, ) { } diff --git a/src/Controller/Import/ReadabilityController.php b/src/Controller/Import/ReadabilityController.php index 0d90f1eec..4af63f5ae 100644 --- a/src/Controller/Import/ReadabilityController.php +++ b/src/Controller/Import/ReadabilityController.php @@ -16,8 +16,8 @@ use Wallabag\Redis\Producer as RedisProducer; class ReadabilityController extends AbstractController { public function __construct( - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, ) { } diff --git a/src/Controller/Import/ShaarliController.php b/src/Controller/Import/ShaarliController.php index f02539365..b936d0251 100644 --- a/src/Controller/Import/ShaarliController.php +++ b/src/Controller/Import/ShaarliController.php @@ -14,10 +14,10 @@ use Wallabag\Redis\Producer as RedisProducer; class ShaarliController extends HtmlController { public function __construct( - private ShaarliImport $shaarliImport, - private Config $craueConfig, - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, + private readonly ShaarliImport $shaarliImport, + private readonly Config $craueConfig, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, ) { } diff --git a/src/Controller/Import/WallabagV1Controller.php b/src/Controller/Import/WallabagV1Controller.php index 7ad6e32fe..47f4c74c5 100644 --- a/src/Controller/Import/WallabagV1Controller.php +++ b/src/Controller/Import/WallabagV1Controller.php @@ -14,10 +14,10 @@ use Wallabag\Redis\Producer as RedisProducer; class WallabagV1Controller extends WallabagController { public function __construct( - private WallabagV1Import $wallabagImport, - private Config $craueConfig, - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, + private readonly WallabagV1Import $wallabagImport, + private readonly Config $craueConfig, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, ) { } diff --git a/src/Controller/Import/WallabagV2Controller.php b/src/Controller/Import/WallabagV2Controller.php index f676438cd..d185cae0b 100644 --- a/src/Controller/Import/WallabagV2Controller.php +++ b/src/Controller/Import/WallabagV2Controller.php @@ -14,10 +14,10 @@ use Wallabag\Redis\Producer as RedisProducer; class WallabagV2Controller extends WallabagController { public function __construct( - private WallabagV2Import $wallabagImport, - private Config $craueConfig, - private RabbitMqProducer $rabbitMqProducer, - private RedisProducer $redisProducer, + private readonly WallabagV2Import $wallabagImport, + private readonly Config $craueConfig, + private readonly RabbitMqProducer $rabbitMqProducer, + private readonly RedisProducer $redisProducer, ) { } diff --git a/src/Controller/SiteCredentialController.php b/src/Controller/SiteCredentialController.php index 2e6a55e38..7f60d692a 100644 --- a/src/Controller/SiteCredentialController.php +++ b/src/Controller/SiteCredentialController.php @@ -24,10 +24,10 @@ use Wallabag\Repository\SiteCredentialRepository; class SiteCredentialController extends AbstractController { public function __construct( - private EntityManagerInterface $entityManager, - private TranslatorInterface $translator, - private CryptoProxy $cryptoProxy, - private Config $craueConfig, + private readonly EntityManagerInterface $entityManager, + private readonly TranslatorInterface $translator, + private readonly CryptoProxy $cryptoProxy, + private readonly Config $craueConfig, ) { } diff --git a/src/Controller/TagController.php b/src/Controller/TagController.php index 87cb38322..9a3db5360 100644 --- a/src/Controller/TagController.php +++ b/src/Controller/TagController.php @@ -26,10 +26,10 @@ use Wallabag\Repository\TagRepository; class TagController extends AbstractController { public function __construct( - private EntityManagerInterface $entityManager, - private TagsAssigner $tagsAssigner, - private Redirect $redirectHelper, - private Security $security, + private readonly EntityManagerInterface $entityManager, + private readonly TagsAssigner $tagsAssigner, + private readonly Redirect $redirectHelper, + private readonly Security $security, ) { } diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index ef37bfe0c..74af9c3ed 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -30,8 +30,8 @@ use Wallabag\Repository\UserRepository; class UserController extends AbstractController { public function __construct( - private EntityManagerInterface $entityManager, - private TranslatorInterface $translator, + private readonly EntityManagerInterface $entityManager, + private readonly TranslatorInterface $translator, ) { } diff --git a/src/Doctrine/MigrationFactoryDecorator.php b/src/Doctrine/MigrationFactoryDecorator.php index 0737fbfa6..b99f31af0 100644 --- a/src/Doctrine/MigrationFactoryDecorator.php +++ b/src/Doctrine/MigrationFactoryDecorator.php @@ -11,10 +11,10 @@ use Doctrine\Migrations\Version\MigrationFactory; class MigrationFactoryDecorator implements MigrationFactory { public function __construct( - private MigrationFactory $migrationFactory, - private string $tablePrefix, - private array $defaultIgnoreOriginInstanceRules, - private string $fetchingErrorMessage, + private readonly MigrationFactory $migrationFactory, + private readonly string $tablePrefix, + private readonly array $defaultIgnoreOriginInstanceRules, + private readonly string $fetchingErrorMessage, ) { } diff --git a/src/Event/Listener/AuthenticationFailureListener.php b/src/Event/Listener/AuthenticationFailureListener.php index 24d167c71..077eeec80 100644 --- a/src/Event/Listener/AuthenticationFailureListener.php +++ b/src/Event/Listener/AuthenticationFailureListener.php @@ -10,8 +10,8 @@ use Symfony\Component\Security\Http\Event\LoginFailureEvent; class AuthenticationFailureListener implements EventSubscriberInterface { public function __construct( - private RequestStack $requestStack, - private LoggerInterface $logger, + private readonly RequestStack $requestStack, + private readonly LoggerInterface $logger, ) { } diff --git a/src/Event/Listener/CreateConfigListener.php b/src/Event/Listener/CreateConfigListener.php index fe8e1c929..e7af5a15b 100644 --- a/src/Event/Listener/CreateConfigListener.php +++ b/src/Event/Listener/CreateConfigListener.php @@ -16,7 +16,7 @@ use Wallabag\Entity\Config; class CreateConfigListener implements EventSubscriberInterface { public function __construct( - private EntityManagerInterface $em, + private readonly EntityManagerInterface $em, private $itemsOnPage, private $feedLimit, private $language, @@ -24,7 +24,7 @@ class CreateConfigListener implements EventSubscriberInterface private $actionMarkAsRead, private $listMode, private $displayThumbnails, - private RequestStack $requestStack, + private readonly RequestStack $requestStack, ) { } diff --git a/src/Event/Listener/PasswordResettingListener.php b/src/Event/Listener/PasswordResettingListener.php index 4d3954b7d..b34522167 100644 --- a/src/Event/Listener/PasswordResettingListener.php +++ b/src/Event/Listener/PasswordResettingListener.php @@ -16,7 +16,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; class PasswordResettingListener implements EventSubscriberInterface { public function __construct( - private UrlGeneratorInterface $router, + private readonly UrlGeneratorInterface $router, ) { } diff --git a/src/Event/Listener/RegistrationListener.php b/src/Event/Listener/RegistrationListener.php index 3581c074a..eaeef75f5 100644 --- a/src/Event/Listener/RegistrationListener.php +++ b/src/Event/Listener/RegistrationListener.php @@ -15,7 +15,7 @@ class RegistrationListener implements EventSubscriberInterface */ public function __construct( private $registrationEnabled, - private UrlGeneratorInterface $urlGenerator, + private readonly UrlGeneratorInterface $urlGenerator, ) { } diff --git a/src/Event/Listener/UserLocaleListener.php b/src/Event/Listener/UserLocaleListener.php index 7387de92f..5c9403376 100644 --- a/src/Event/Listener/UserLocaleListener.php +++ b/src/Event/Listener/UserLocaleListener.php @@ -17,7 +17,7 @@ use Wallabag\Entity\User; class UserLocaleListener { public function __construct( - private SessionInterface $session, + private readonly SessionInterface $session, ) { } diff --git a/src/Event/Subscriber/DownloadImagesSubscriber.php b/src/Event/Subscriber/DownloadImagesSubscriber.php index 68c5a2049..5324f449c 100644 --- a/src/Event/Subscriber/DownloadImagesSubscriber.php +++ b/src/Event/Subscriber/DownloadImagesSubscriber.php @@ -13,10 +13,10 @@ use Wallabag\Helper\DownloadImages; class DownloadImagesSubscriber implements EventSubscriberInterface { public function __construct( - private EntityManagerInterface $em, - private DownloadImages $downloadImages, + private readonly EntityManagerInterface $em, + private readonly DownloadImages $downloadImages, private $enabled, - private LoggerInterface $logger, + private readonly LoggerInterface $logger, ) { } diff --git a/src/Event/Subscriber/GenerateCustomCSSSubscriber.php b/src/Event/Subscriber/GenerateCustomCSSSubscriber.php index f6a47889f..06dfbdbd5 100644 --- a/src/Event/Subscriber/GenerateCustomCSSSubscriber.php +++ b/src/Event/Subscriber/GenerateCustomCSSSubscriber.php @@ -10,8 +10,8 @@ use Wallabag\Event\ConfigUpdatedEvent; class GenerateCustomCSSSubscriber implements EventSubscriberInterface { public function __construct( - private EntityManagerInterface $em, - private Compiler $compiler, + private readonly EntityManagerInterface $em, + private readonly Compiler $compiler, ) { } diff --git a/src/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php b/src/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php index 622cad030..5e3e2ea68 100644 --- a/src/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php +++ b/src/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php @@ -18,7 +18,7 @@ use Wallabag\Entity\Entry; class SQLiteCascadeDeleteSubscriber implements EventSubscriber { public function __construct( - private ManagerRegistry $doctrine, + private readonly ManagerRegistry $doctrine, ) { } diff --git a/src/Event/Subscriber/SchemaAdapterSubscriber.php b/src/Event/Subscriber/SchemaAdapterSubscriber.php index dcee8c540..ae02181dd 100644 --- a/src/Event/Subscriber/SchemaAdapterSubscriber.php +++ b/src/Event/Subscriber/SchemaAdapterSubscriber.php @@ -9,7 +9,7 @@ use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs; class SchemaAdapterSubscriber implements EventSubscriber { public function __construct( - private string $databaseTablePrefix, + private readonly string $databaseTablePrefix, ) { } diff --git a/src/ExpressionLanguage/AuthenticatorProvider.php b/src/ExpressionLanguage/AuthenticatorProvider.php index f7a3d6392..c98db51fd 100644 --- a/src/ExpressionLanguage/AuthenticatorProvider.php +++ b/src/ExpressionLanguage/AuthenticatorProvider.php @@ -10,7 +10,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface; class AuthenticatorProvider implements ExpressionFunctionProviderInterface { public function __construct( - private HttpClientInterface $requestHtmlFunctionClient, + private readonly HttpClientInterface $requestHtmlFunctionClient, ) { } diff --git a/src/Form/Type/EntryFilterType.php b/src/Form/Type/EntryFilterType.php index c95cb22f2..f4e9b76f0 100644 --- a/src/Form/Type/EntryFilterType.php +++ b/src/Form/Type/EntryFilterType.php @@ -25,8 +25,8 @@ class EntryFilterType extends AbstractType * Repository & user are used to get a list of language entries for this user. */ public function __construct( - private EntryRepository $repository, - private TokenStorageInterface $tokenStorage, + private readonly EntryRepository $repository, + private readonly TokenStorageInterface $tokenStorage, ) { } diff --git a/src/Helper/CryptoProxy.php b/src/Helper/CryptoProxy.php index 434e8e04d..fc1814109 100644 --- a/src/Helper/CryptoProxy.php +++ b/src/Helper/CryptoProxy.php @@ -17,7 +17,7 @@ class CryptoProxy public function __construct( $encryptionKeyPath, - private LoggerInterface $logger, + private readonly LoggerInterface $logger, ) { if (!file_exists($encryptionKeyPath)) { $key = Key::createNewRandomKey(); diff --git a/src/Helper/DownloadImages.php b/src/Helper/DownloadImages.php index b3eedfc14..afce04c90 100644 --- a/src/Helper/DownloadImages.php +++ b/src/Helper/DownloadImages.php @@ -20,10 +20,10 @@ class DownloadImages private $wallabagUrl; public function __construct( - private HttpClientInterface $client, + private readonly HttpClientInterface $client, private $baseFolder, $wallabagUrl, - private LoggerInterface $logger, + private readonly LoggerInterface $logger, ) { $this->wallabagUrl = rtrim($wallabagUrl, '/'); $this->mimeTypes = new MimeTypes(); diff --git a/src/Helper/EntriesExport.php b/src/Helper/EntriesExport.php index da004b05e..64360c3e2 100644 --- a/src/Helper/EntriesExport.php +++ b/src/Helper/EntriesExport.php @@ -31,10 +31,10 @@ class EntriesExport * @param TokenStorageInterface $tokenStorage Needed to retrieve the current user */ public function __construct( - private TranslatorInterface $translator, + private readonly TranslatorInterface $translator, private $wallabagUrl, private $logoPath, - private TokenStorageInterface $tokenStorage, + private readonly TokenStorageInterface $tokenStorage, ) { } diff --git a/src/Helper/PreparePagerForEntries.php b/src/Helper/PreparePagerForEntries.php index 808c70ccf..fe0446e6a 100644 --- a/src/Helper/PreparePagerForEntries.php +++ b/src/Helper/PreparePagerForEntries.php @@ -11,7 +11,7 @@ use Wallabag\Entity\User; class PreparePagerForEntries { public function __construct( - private TokenStorageInterface $tokenStorage, + private readonly TokenStorageInterface $tokenStorage, ) { } diff --git a/src/Helper/Redirect.php b/src/Helper/Redirect.php index cd2b7b23d..77aec7ab4 100644 --- a/src/Helper/Redirect.php +++ b/src/Helper/Redirect.php @@ -14,8 +14,8 @@ use Wallabag\Entity\User; class Redirect { public function __construct( - private UrlGeneratorInterface $router, - private TokenStorageInterface $tokenStorage, + private readonly UrlGeneratorInterface $router, + private readonly TokenStorageInterface $tokenStorage, ) { } diff --git a/src/Helper/RuleBasedTagger.php b/src/Helper/RuleBasedTagger.php index a3a17d651..d40604d50 100644 --- a/src/Helper/RuleBasedTagger.php +++ b/src/Helper/RuleBasedTagger.php @@ -15,10 +15,10 @@ use Wallabag\Repository\TagRepository; class RuleBasedTagger { public function __construct( - private RulerZ $rulerz, - private TagRepository $tagRepository, - private EntryRepository $entryRepository, - private LoggerInterface $logger, + private readonly RulerZ $rulerz, + private readonly TagRepository $tagRepository, + private readonly EntryRepository $entryRepository, + private readonly LoggerInterface $logger, ) { } diff --git a/src/HttpClient/Authenticator.php b/src/HttpClient/Authenticator.php index 8191c02a4..40028e5ec 100644 --- a/src/HttpClient/Authenticator.php +++ b/src/HttpClient/Authenticator.php @@ -18,8 +18,8 @@ class Authenticator implements LoggerAwareInterface private $logger; public function __construct( - private SiteConfigBuilder $configBuilder, - private LoginFormAuthenticator $authenticator, + private readonly SiteConfigBuilder $configBuilder, + private readonly LoginFormAuthenticator $authenticator, ) { $this->logger = new NullLogger(); } diff --git a/src/HttpClient/WallabagClient.php b/src/HttpClient/WallabagClient.php index 0eb900318..0bf9947ae 100644 --- a/src/HttpClient/WallabagClient.php +++ b/src/HttpClient/WallabagClient.php @@ -11,13 +11,13 @@ use Symfony\Contracts\HttpClient\ResponseStreamInterface; class WallabagClient implements HttpClientInterface { - private HttpClientInterface $httpClient; + private readonly HttpClientInterface $httpClient; public function __construct( private $restrictedAccess, - private HttpBrowser $browser, - private Authenticator $authenticator, - private LoggerInterface $logger, + private readonly HttpBrowser $browser, + private readonly Authenticator $authenticator, + private readonly LoggerInterface $logger, ) { $this->httpClient = HttpClient::create([ 'timeout' => 10, diff --git a/src/Mailer/AuthCodeMailer.php b/src/Mailer/AuthCodeMailer.php index 3cbc4674a..858ba547f 100644 --- a/src/Mailer/AuthCodeMailer.php +++ b/src/Mailer/AuthCodeMailer.php @@ -22,8 +22,8 @@ class AuthCodeMailer implements AuthCodeMailerInterface * @param string $supportUrl support URL to report any bugs */ public function __construct( - private MailerInterface $mailer, - private Environment $twig, + private readonly MailerInterface $mailer, + private readonly Environment $twig, private $senderEmail, private $senderName, private $supportUrl, diff --git a/src/ParamConverter/UsernameFeedTokenConverter.php b/src/ParamConverter/UsernameFeedTokenConverter.php index 186e725c3..8e54e874c 100644 --- a/src/ParamConverter/UsernameFeedTokenConverter.php +++ b/src/ParamConverter/UsernameFeedTokenConverter.php @@ -22,7 +22,7 @@ class UsernameFeedTokenConverter implements ParamConverterInterface * @param ManagerRegistry $registry Manager registry */ public function __construct( - private ?ManagerRegistry $registry = null, + private readonly ?ManagerRegistry $registry = null, ) { } diff --git a/src/Redis/Producer.php b/src/Redis/Producer.php index 8c455e0fc..1e8c487d1 100644 --- a/src/Redis/Producer.php +++ b/src/Redis/Producer.php @@ -16,7 +16,7 @@ use Simpleue\Queue\RedisQueue; class Producer implements ProducerInterface { public function __construct( - private RedisQueue $queue, + private readonly RedisQueue $queue, ) { } diff --git a/src/Repository/SiteCredentialRepository.php b/src/Repository/SiteCredentialRepository.php index 631231b29..3e1d1a357 100644 --- a/src/Repository/SiteCredentialRepository.php +++ b/src/Repository/SiteCredentialRepository.php @@ -16,7 +16,7 @@ class SiteCredentialRepository extends ServiceEntityRepository { public function __construct( ManagerRegistry $registry, - private CryptoProxy $cryptoProxy, + private readonly CryptoProxy $cryptoProxy, ) { parent::__construct($registry, SiteCredential::class); } diff --git a/src/Repository/TagRepository.php b/src/Repository/TagRepository.php index 3fe8a2e88..7440bf3c0 100644 --- a/src/Repository/TagRepository.php +++ b/src/Repository/TagRepository.php @@ -16,7 +16,7 @@ class TagRepository extends ServiceEntityRepository { public function __construct( ManagerRegistry $registry, - private string $tablePrefix, + private readonly string $tablePrefix, ) { parent::__construct($registry, Tag::class); } diff --git a/src/Security/Voter/AdminVoter.php b/src/Security/Voter/AdminVoter.php index 4baa12612..4b96b75e7 100644 --- a/src/Security/Voter/AdminVoter.php +++ b/src/Security/Voter/AdminVoter.php @@ -15,7 +15,7 @@ class AdminVoter extends Voter public const CREATE_IGNORE_ORIGIN_INSTANCE_RULES = 'CREATE_IGNORE_ORIGIN_INSTANCE_RULES'; public function __construct( - private Security $security, + private readonly Security $security, ) { } diff --git a/src/Security/Voter/IgnoreOriginInstanceRuleVoter.php b/src/Security/Voter/IgnoreOriginInstanceRuleVoter.php index 9fc6eb4a9..8035aed28 100644 --- a/src/Security/Voter/IgnoreOriginInstanceRuleVoter.php +++ b/src/Security/Voter/IgnoreOriginInstanceRuleVoter.php @@ -13,7 +13,7 @@ class IgnoreOriginInstanceRuleVoter extends Voter public const DELETE = 'DELETE'; public function __construct( - private Security $security, + private readonly Security $security, ) { } diff --git a/src/Security/Voter/MainVoter.php b/src/Security/Voter/MainVoter.php index 7915ac9c9..478a08099 100644 --- a/src/Security/Voter/MainVoter.php +++ b/src/Security/Voter/MainVoter.php @@ -22,7 +22,7 @@ class MainVoter extends Voter public const EDIT_CONFIG = 'EDIT_CONFIG'; public function __construct( - private Security $security, + private readonly Security $security, ) { } diff --git a/src/Security/Voter/TagVoter.php b/src/Security/Voter/TagVoter.php index f5f239b1b..dccdde979 100644 --- a/src/Security/Voter/TagVoter.php +++ b/src/Security/Voter/TagVoter.php @@ -15,7 +15,7 @@ class TagVoter extends Voter public const DELETE = 'DELETE'; public function __construct( - private Security $security, + private readonly Security $security, ) { } diff --git a/src/Security/Voter/UserVoter.php b/src/Security/Voter/UserVoter.php index 9e1bdced9..8d111eeea 100644 --- a/src/Security/Voter/UserVoter.php +++ b/src/Security/Voter/UserVoter.php @@ -13,7 +13,7 @@ class UserVoter extends Voter public const DELETE = 'DELETE'; public function __construct( - private Security $security, + private readonly Security $security, ) { } diff --git a/src/SiteConfig/GrabySiteConfigBuilder.php b/src/SiteConfig/GrabySiteConfigBuilder.php index fe8ba1173..422e54fa0 100644 --- a/src/SiteConfig/GrabySiteConfigBuilder.php +++ b/src/SiteConfig/GrabySiteConfigBuilder.php @@ -13,10 +13,10 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder * GrabySiteConfigBuilder constructor. */ public function __construct( - private ConfigBuilder $grabyConfigBuilder, - private TokenStorageInterface $token, - private SiteCredentialRepository $credentialRepository, - private LoggerInterface $logger, + private readonly ConfigBuilder $grabyConfigBuilder, + private readonly TokenStorageInterface $token, + private readonly SiteCredentialRepository $credentialRepository, + private readonly LoggerInterface $logger, ) { } diff --git a/src/SiteConfig/LoginFormAuthenticator.php b/src/SiteConfig/LoginFormAuthenticator.php index 3a4050714..f50ea3a1c 100644 --- a/src/SiteConfig/LoginFormAuthenticator.php +++ b/src/SiteConfig/LoginFormAuthenticator.php @@ -9,10 +9,10 @@ use Wallabag\ExpressionLanguage\AuthenticatorProvider; class LoginFormAuthenticator { - private ExpressionLanguage $expressionLanguage; + private readonly ExpressionLanguage $expressionLanguage; public function __construct( - private HttpBrowser $browser, + private readonly HttpBrowser $browser, AuthenticatorProvider $authenticatorProvider, ) { $this->expressionLanguage = new ExpressionLanguage(null, [$authenticatorProvider]); diff --git a/src/Twig/WallabagExtension.php b/src/Twig/WallabagExtension.php index 649bc3503..81cbffbc5 100644 --- a/src/Twig/WallabagExtension.php +++ b/src/Twig/WallabagExtension.php @@ -16,13 +16,13 @@ use Wallabag\Repository\TagRepository; class WallabagExtension extends AbstractExtension implements GlobalsInterface { public function __construct( - private EntryRepository $entryRepository, - private AnnotationRepository $annotationRepository, - private TagRepository $tagRepository, - private TokenStorageInterface $tokenStorage, + private readonly EntryRepository $entryRepository, + private readonly AnnotationRepository $annotationRepository, + private readonly TagRepository $tagRepository, + private readonly TokenStorageInterface $tokenStorage, private $lifeTime, - private TranslatorInterface $translator, - private string $projectDir, + private readonly TranslatorInterface $translator, + private readonly string $projectDir, ) { }