diff --git a/Classes/Cache/Listener/ForceStaticCacheListener.php b/Classes/Cache/Listener/ForceStaticCacheListener.php index 66e1fbded7f..51e0a0e2dfb 100644 --- a/Classes/Cache/Listener/ForceStaticCacheListener.php +++ b/Classes/Cache/Listener/ForceStaticCacheListener.php @@ -15,15 +15,7 @@ */ class ForceStaticCacheListener { - protected EventDispatcherInterface $eventDispatcher; - - /** - * PrepareMiddleware constructor. - */ - public function __construct(EventDispatcherInterface $eventDispatcher) - { - $this->eventDispatcher = $eventDispatcher; - } + public function __construct(readonly protected EventDispatcherInterface $eventDispatcher) {} public function __invoke(CacheRuleEvent $event): void { diff --git a/Classes/Command/AbstractCommand.php b/Classes/Command/AbstractCommand.php index 40890e2e042..d458a9061f7 100644 --- a/Classes/Command/AbstractCommand.php +++ b/Classes/Command/AbstractCommand.php @@ -6,17 +6,8 @@ use Symfony\Component\Console\Command\Command; -/** - * AbstractCommand. - */ abstract class AbstractCommand extends Command { - /** - * Set generic prefix for the description. - * - * - * @return $this - */ public function setDescription(string $description): static { return parent::setDescription('StaticFileCache task: ' . $description); diff --git a/Classes/Command/BoostQueueCommand.php b/Classes/Command/BoostQueueCommand.php index 03514d0cc3a..4a478d5971d 100644 --- a/Classes/Command/BoostQueueCommand.php +++ b/Classes/Command/BoostQueueCommand.php @@ -12,56 +12,22 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; -/** - * BoostQueueRunCommand. - */ class BoostQueueCommand extends AbstractCommand { - /** - * @var QueueRepository - */ - protected $queueRepository; - - /** - * @var QueueService - */ - protected $queueService; - - public function __construct(QueueRepository $queueRepository, QueueService $queueService) + public function __construct(protected QueueRepository $queueRepository, protected QueueService $queueService) { - $this->queueRepository = $queueRepository; - $this->queueService = $queueService; parent::__construct(); } - /** - * Configures the current command. - */ protected function configure(): void { parent::configure(); - // @todo When compatibility is set to TYPO3 v11+ only, the description can be removed as it is defined in Services.yaml - $this->setDescription('Run (work on) the cache boost queue. Call this task every 5 minutes.') - ->addOption('limit-items', null, InputOption::VALUE_REQUIRED, 'Limit the items that are crawled. 0 => all', 500) + $this->addOption('limit-items', null, InputOption::VALUE_REQUIRED, 'Limit the items that are crawled. 0 => all', 500) ->addOption('stop-processing-after', null, InputOption::VALUE_REQUIRED, 'Stop crawling new items after N seconds since scheduler task started. 0 => infinite', 240) ->addOption('avoid-cleanup', null, InputOption::VALUE_NONE, 'Avoid the cleanup of the queue items') ; } - /** - * Executes the current command. - * - * This method is not abstract because you can use this class - * as a concrete class. In this case, instead of defining the - * execute() method, you set the code to execute by passing - * a Closure to the setCode() method. - * - * @throws NoSuchCacheException - * - * @return int null or 0 if everything went fine, or an error code - * - * @see setCode() - */ protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); @@ -94,9 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return self::SUCCESS; } - /** - * Cleanup queue. - */ + protected function cleanupQueue(SymfonyStyle $io): void { $uids = $this->queueRepository->findOldUids(); diff --git a/Classes/Command/FlushCacheCommand.php b/Classes/Command/FlushCacheCommand.php index 1ba5b9c01d2..e3a7ec920e4 100644 --- a/Classes/Command/FlushCacheCommand.php +++ b/Classes/Command/FlushCacheCommand.php @@ -12,38 +12,15 @@ use Symfony\Component\Console\Output\OutputInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -/** - * FlushCacheCommand. - */ class FlushCacheCommand extends AbstractCommand { - /** - * Configures the current command. - */ protected function configure(): void { parent::configure(); - // @todo When compatibility is set to TYPO3 v11+ only, the description can be removed as it is defined in Services.yaml - $this->setDescription('Flush the cache. If the boost mode is active, all pages are added to the queue (you have to run the BoostQueueRun Command to recrawl the pages). If you use the force-boost-mode-flush argument, you directly drop the cache even the page is in Boostmode.') - ->addOption('force-boost-mode-flush', null, InputOption::VALUE_NONE, 'Force a boost mode flush') + $this->addOption('force-boost-mode-flush', null, InputOption::VALUE_NONE, 'Force a boost mode flush') ; } - /** - * Executes the current command. - * - * This method is not abstract because you can use this class - * as a concrete class. In this case, instead of defining the - * execute() method, you set the code to execute by passing - * a Closure to the setCode() method. - * - * @throws NoSuchCacheException - * @throws NoSuchCacheGroupException - * - * @return int null or 0 if everything went fine, or an error code - * - * @see setCode() - */ protected function execute(InputInterface $input, OutputInterface $output): int { $cacheService = GeneralUtility::makeInstance(CacheService::class); diff --git a/Classes/Configuration.php b/Classes/Configuration.php index 19c29074af7..27fce2dbb63 100644 --- a/Classes/Configuration.php +++ b/Classes/Configuration.php @@ -42,9 +42,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Utility\ExtensionUtility; -/** - * Configuration. - */ class Configuration extends StaticFileCacheObject { public const EXTENSION_KEY = 'staticfilecache'; diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index 882363105c5..01bd383198e 100644 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -23,22 +23,9 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; -/** - * StaticFileCache backend module. - */ class BackendController extends ActionController { - protected QueueService $queueService; - protected ModuleTemplateFactory $moduleTemplateFactory; - - /** - * BackendController constructor. - */ - public function __construct(QueueService $queueService, ModuleTemplateFactory $moduleTemplateFactory) - { - $this->queueService = $queueService; - $this->moduleTemplateFactory = $moduleTemplateFactory; - } + public function __construct(protected QueueService $queueService, protected ModuleTemplateFactory $moduleTemplateFactory) {} public function listAction(string $filter = ''): ResponseInterface { diff --git a/Classes/Event/BuildClientEvent.php b/Classes/Event/BuildClientEvent.php index cd7fde38c9e..d28149dcecf 100644 --- a/Classes/Event/BuildClientEvent.php +++ b/Classes/Event/BuildClientEvent.php @@ -6,15 +6,7 @@ final class BuildClientEvent { - private array $options; - - private array $httpOptions; - - public function __construct(array $options, array $httpOptions) - { - $this->options = $options; - $this->httpOptions = $httpOptions; - } + public function __construct(private array $options, private array $httpOptions) {} public function getOptions(): array { diff --git a/Classes/Event/CacheRuleEvent.php b/Classes/Event/CacheRuleEvent.php index 18ff4a549ac..6183e4a8dd6 100644 --- a/Classes/Event/CacheRuleEvent.php +++ b/Classes/Event/CacheRuleEvent.php @@ -8,18 +8,11 @@ final class CacheRuleEvent implements CacheRuleEventInterface { - private ServerRequestInterface $request; - - private array $explanation; - - private bool $skipProcessing; - - public function __construct(ServerRequestInterface $request, array $explanation, bool $skipProcessing) - { - $this->request = $request; - $this->explanation = $explanation; - $this->skipProcessing = $skipProcessing; - } + public function __construct( + private ServerRequestInterface $request, + private array $explanation, + private bool $skipProcessing + ) {} public function getRequest(): ServerRequestInterface { diff --git a/Classes/Event/CacheRuleFallbackEvent.php b/Classes/Event/CacheRuleFallbackEvent.php index f693beab50d..9459adc7783 100644 --- a/Classes/Event/CacheRuleFallbackEvent.php +++ b/Classes/Event/CacheRuleFallbackEvent.php @@ -8,18 +8,7 @@ final class CacheRuleFallbackEvent implements CacheRuleEventInterface { - private ServerRequestInterface $request; - - private array $explanation; - - private bool $skipProcessing; - - public function __construct(ServerRequestInterface $request, array $explanation, bool $skipProcessing) - { - $this->request = $request; - $this->explanation = $explanation; - $this->skipProcessing = $skipProcessing; - } + public function __construct(private ServerRequestInterface $request, private array $explanation, private bool $skipProcessing) {} public function getRequest(): ServerRequestInterface { diff --git a/Classes/Event/ForceStaticFileCacheEvent.php b/Classes/Event/ForceStaticFileCacheEvent.php index 296174c2f0e..5af60d63143 100644 --- a/Classes/Event/ForceStaticFileCacheEvent.php +++ b/Classes/Event/ForceStaticFileCacheEvent.php @@ -9,21 +9,7 @@ final class ForceStaticFileCacheEvent { - private bool $forceStatic; - - private ?TypoScriptFrontendController $frontendController; - - private ServerRequestInterface $request; - - /** - * ForceStaticFileCacheEvent constructor. - */ - public function __construct(bool $forceStatic, ?TypoScriptFrontendController $frontendController, ServerRequestInterface $request) - { - $this->forceStatic = $forceStatic; - $this->frontendController = $frontendController; - $this->request = $request; - } + public function __construct(private bool $forceStatic, private ?TypoScriptFrontendController $frontendController, private ServerRequestInterface $request) {} public function isForceStatic(): bool { diff --git a/Classes/Event/PreGenerateEvent.php b/Classes/Event/PreGenerateEvent.php index 35e10c44de6..8a2734b561b 100644 --- a/Classes/Event/PreGenerateEvent.php +++ b/Classes/Event/PreGenerateEvent.php @@ -9,18 +9,7 @@ final class PreGenerateEvent { - private string $uri; - - private ServerRequestInterface $request; - - private ResponseInterface $response; - - public function __construct(string $uri, ServerRequestInterface $request, ResponseInterface $response) - { - $this->uri = $uri; - $this->request = $request; - $this->response = $response; - } + public function __construct(private string $uri, private ServerRequestInterface $request, private ResponseInterface $response) {} public function getUri(): string { diff --git a/Classes/Middleware/CookieCheckMiddleware.php b/Classes/Middleware/CookieCheckMiddleware.php index 7153821312c..18f45b16551 100644 --- a/Classes/Middleware/CookieCheckMiddleware.php +++ b/Classes/Middleware/CookieCheckMiddleware.php @@ -17,19 +17,7 @@ */ class CookieCheckMiddleware implements MiddlewareInterface { - protected Context $context; - protected CookieService $cookieService; - protected EventDispatcherInterface $eventDispatcher; - - /** - * CookieCheckMiddleware constructor. - */ - public function __construct(Context $context, CookieService $cookieService, EventDispatcherInterface $eventDispatcher) - { - $this->context = $context; - $this->cookieService = $cookieService; - $this->eventDispatcher = $eventDispatcher; - } + public function __construct(protected Context $context, protected CookieService $cookieService, protected EventDispatcherInterface $eventDispatcher) {} /** * Check for the sfc cookie and remove it when there is no valid user session. diff --git a/Classes/Middleware/FallbackMiddleware.php b/Classes/Middleware/FallbackMiddleware.php index 2595327f004..b09d7fcedbf 100644 --- a/Classes/Middleware/FallbackMiddleware.php +++ b/Classes/Middleware/FallbackMiddleware.php @@ -23,19 +23,8 @@ */ class FallbackMiddleware implements MiddlewareInterface { - protected EventDispatcherInterface$eventDispatcher; + public function __construct(protected EventDispatcherInterface $eventDispatcher, protected ConfigurationService $configurationService) {} - protected ConfigurationService $configurationService; - - public function __construct(EventDispatcherInterface $eventDispatcher, ConfigurationService $configurationService) - { - $this->eventDispatcher = $eventDispatcher; - $this->configurationService = $configurationService; - } - - /** - * Process the fallback middleware. - */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { try { diff --git a/Classes/Middleware/GenerateMiddleware.php b/Classes/Middleware/GenerateMiddleware.php index 5cbce3b4ca0..69e8027c31b 100644 --- a/Classes/Middleware/GenerateMiddleware.php +++ b/Classes/Middleware/GenerateMiddleware.php @@ -19,25 +19,12 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; -/** - * GenerateMiddleware. - */ class GenerateMiddleware implements MiddlewareInterface { protected ?UriFrontend $cache = null; - protected EventDispatcherInterface $eventDispatcher; - protected CookieService $cookieService; - - /** - * GenerateMiddleware constructor. - */ - public function __construct(EventDispatcherInterface $eventDispatcher, CookieService $cookieService) - { - $this->eventDispatcher = $eventDispatcher; - $this->cookieService = $cookieService; - } + public function __construct(protected EventDispatcherInterface $eventDispatcher, protected CookieService $cookieService) {} /** * Process an incoming server request. diff --git a/Classes/Middleware/PrepareMiddleware.php b/Classes/Middleware/PrepareMiddleware.php index ea4b67f19ab..7f578bad43f 100644 --- a/Classes/Middleware/PrepareMiddleware.php +++ b/Classes/Middleware/PrepareMiddleware.php @@ -24,15 +24,7 @@ */ class PrepareMiddleware implements MiddlewareInterface { - protected EventDispatcherInterface $eventDispatcher; - - /** - * PrepareMiddleware constructor. - */ - public function __construct(EventDispatcherInterface $eventDispatcher) - { - $this->eventDispatcher = $eventDispatcher; - } + public function __construct(protected EventDispatcherInterface $eventDispatcher) {} /** * Process an incoming server request. diff --git a/Classes/Service/ClientService.php b/Classes/Service/ClientService.php index a88986172f5..15e50dca196 100644 --- a/Classes/Service/ClientService.php +++ b/Classes/Service/ClientService.php @@ -18,15 +18,7 @@ */ class ClientService extends AbstractService { - protected EventDispatcherInterface $eventDispatcher; - - /** - * PrepareMiddleware constructor. - */ - public function __construct(EventDispatcherInterface $eventDispatcher) - { - $this->eventDispatcher = $eventDispatcher; - } + public function __construct(protected EventDispatcherInterface $eventDispatcher) {} /** * Run a single request with guzzle and return status code. diff --git a/Classes/Service/QueueService.php b/Classes/Service/QueueService.php index deb8ea52f93..190a9c46d7f 100644 --- a/Classes/Service/QueueService.php +++ b/Classes/Service/QueueService.php @@ -19,27 +19,12 @@ class QueueService extends AbstractService public const PRIORITY_MEDIUM = 1000; public const PRIORITY_LOW = 0; - /** - * Queue repository. - */ - protected QueueRepository $queueRepository; - - protected ConfigurationService $configurationService; - - protected ClientService $clientService; - - protected CacheService $cacheService; - - /** - * QueueService constructor. - */ - public function __construct(QueueRepository $queueRepository, ConfigurationService $configurationService, ClientService $clientService, CacheService $cacheService) - { - $this->queueRepository = $queueRepository; - $this->configurationService = $configurationService; - $this->clientService = $clientService; - $this->cacheService = $cacheService; - } + public function __construct( + protected QueueRepository $queueRepository, + protected ConfigurationService $configurationService, + protected ClientService $clientService, + protected CacheService $cacheService + ) {} /** * Add identifiers to Queue.