diff --git a/rector.php b/rector.php index 1b4259ec..27c4687d 100644 --- a/rector.php +++ b/rector.php @@ -10,7 +10,7 @@ use Rector\Symfony\Set\SymfonySetList; return static function (RectorConfig $rectorConfig): void { - $rectorConfig->phpVersion(phpVersion: PhpVersion::PHP_80); + $rectorConfig->phpVersion(phpVersion: PhpVersion::PHP_81); $rectorConfig->importNames(); $rectorConfig->importShortClasses(); $rectorConfig->parallel(seconds: 600, maxNumberOfProcess: 32); @@ -54,6 +54,7 @@ SetList::PHP_73, SetList::PHP_74, SetList::PHP_80, + SetList::PHP_81, SetList::UNWRAP_COMPAT, ]); diff --git a/src/Bridge/Doctrine/Connection/AbstractDoctrineConnection.php b/src/Bridge/Doctrine/Connection/AbstractDoctrineConnection.php index 311a0a75..bf80c822 100644 --- a/src/Bridge/Doctrine/Connection/AbstractDoctrineConnection.php +++ b/src/Bridge/Doctrine/Connection/AbstractDoctrineConnection.php @@ -16,7 +16,7 @@ */ abstract class AbstractDoctrineConnection { - public function __construct(private DBALConnection $driverConnection) + public function __construct(private readonly DBALConnection $driverConnection) { } diff --git a/src/Bridge/Doctrine/Transport/Configuration/DoctrineConfigurationFactory.php b/src/Bridge/Doctrine/Transport/Configuration/DoctrineConfigurationFactory.php index c830e027..9af1dd7b 100644 --- a/src/Bridge/Doctrine/Transport/Configuration/DoctrineConfigurationFactory.php +++ b/src/Bridge/Doctrine/Transport/Configuration/DoctrineConfigurationFactory.php @@ -19,7 +19,7 @@ */ final class DoctrineConfigurationFactory implements ConfigurationFactoryInterface { - public function __construct(private ConnectionRegistry $registry) + public function __construct(private readonly ConnectionRegistry $registry) { } diff --git a/src/Bridge/Doctrine/Transport/DoctrineTransportFactory.php b/src/Bridge/Doctrine/Transport/DoctrineTransportFactory.php index 74b6104a..8232d07a 100644 --- a/src/Bridge/Doctrine/Transport/DoctrineTransportFactory.php +++ b/src/Bridge/Doctrine/Transport/DoctrineTransportFactory.php @@ -21,7 +21,7 @@ */ final class DoctrineTransportFactory implements TransportFactoryInterface { - public function __construct(private ConnectionRegistry $registry) + public function __construct(private readonly ConnectionRegistry $registry) { } diff --git a/src/Bridge/Redis/Transport/Connection.php b/src/Bridge/Redis/Transport/Connection.php index 2a38dba3..8e9879ec 100644 --- a/src/Bridge/Redis/Transport/Connection.php +++ b/src/Bridge/Redis/Transport/Connection.php @@ -27,13 +27,13 @@ final class Connection implements ConnectionInterface public function __construct( ConfigurationInterface $configuration, - private SerializerInterface $serializer, + private readonly SerializerInterface $serializer, ?Redis $redis = null ) { $this->connection = $redis ?? new Redis(); $this->connection->connect($configuration->get('host'), $configuration->get('port'), $configuration->get('timeout')); - if (!str_starts_with($this->list = $configuration->get('list'), '_')) { + if (!str_starts_with((string) ($this->list = $configuration->get('list')), '_')) { throw new InvalidArgumentException('The list name must start with an underscore'); } diff --git a/src/Command/ConsumeTasksCommand.php b/src/Command/ConsumeTasksCommand.php index d9aa08de..d65ac57e 100644 --- a/src/Command/ConsumeTasksCommand.php +++ b/src/Command/ConsumeTasksCommand.php @@ -41,12 +41,12 @@ )] final class ConsumeTasksCommand extends Command { - private LoggerInterface $logger; + private readonly LoggerInterface $logger; public function __construct( - private SchedulerInterface $scheduler, - private WorkerInterface $worker, - private EventDispatcherInterface $eventDispatcher, + private readonly SchedulerInterface $scheduler, + private readonly WorkerInterface $worker, + private readonly EventDispatcherInterface $eventDispatcher, LoggerInterface $logger = null ) { $this->logger = $logger ?? new NullLogger(); diff --git a/src/Command/DebugConfigurationCommand.php b/src/Command/DebugConfigurationCommand.php index 82c8fdf1..b957e9f1 100644 --- a/src/Command/DebugConfigurationCommand.php +++ b/src/Command/DebugConfigurationCommand.php @@ -22,7 +22,7 @@ )] final class DebugConfigurationCommand extends Command { - public function __construct(private ConfigurationInterface $configuration) + public function __construct(private readonly ConfigurationInterface $configuration) { parent::__construct(); } diff --git a/src/Command/DebugMiddlewareCommand.php b/src/Command/DebugMiddlewareCommand.php index 0a81c748..1f3abdc4 100644 --- a/src/Command/DebugMiddlewareCommand.php +++ b/src/Command/DebugMiddlewareCommand.php @@ -33,8 +33,8 @@ final class DebugMiddlewareCommand extends Command { public function __construct( - private SchedulerMiddlewareStackInterface $schedulerMiddlewareStack, - private WorkerMiddlewareStackInterface $workerMiddlewareStack + private readonly SchedulerMiddlewareStackInterface $schedulerMiddlewareStack, + private readonly WorkerMiddlewareStackInterface $workerMiddlewareStack ) { parent::__construct(); } diff --git a/src/Command/DebugProbeCommand.php b/src/Command/DebugProbeCommand.php index d049ee5a..58698858 100644 --- a/src/Command/DebugProbeCommand.php +++ b/src/Command/DebugProbeCommand.php @@ -29,8 +29,8 @@ final class DebugProbeCommand extends Command { public function __construct( - private ProbeInterface $probe, - private SchedulerInterface $scheduler + private readonly ProbeInterface $probe, + private readonly SchedulerInterface $scheduler ) { parent::__construct(); } diff --git a/src/Command/ExecuteExternalProbeCommand.php b/src/Command/ExecuteExternalProbeCommand.php index dea7c5b3..9d085132 100644 --- a/src/Command/ExecuteExternalProbeCommand.php +++ b/src/Command/ExecuteExternalProbeCommand.php @@ -28,8 +28,8 @@ final class ExecuteExternalProbeCommand extends Command { public function __construct( - private SchedulerInterface $scheduler, - private WorkerInterface $worker + private readonly SchedulerInterface $scheduler, + private readonly WorkerInterface $worker ) { parent::__construct(); } diff --git a/src/Command/ExecuteTaskCommand.php b/src/Command/ExecuteTaskCommand.php index e84e5ce8..8db9e100 100644 --- a/src/Command/ExecuteTaskCommand.php +++ b/src/Command/ExecuteTaskCommand.php @@ -41,16 +41,12 @@ )] final class ExecuteTaskCommand extends Command { - private LoggerInterface $logger; - public function __construct( - private EventDispatcherInterface $eventDispatcher, - private SchedulerInterface $scheduler, - private WorkerInterface $worker, - ?LoggerInterface $logger = null + private readonly EventDispatcherInterface $eventDispatcher, + private readonly SchedulerInterface $scheduler, + private readonly WorkerInterface $worker, + private readonly LoggerInterface $logger = new NullLogger() ) { - $this->logger = $logger ?? new NullLogger(); - parent::__construct(); } diff --git a/src/Command/ListFailedTasksCommand.php b/src/Command/ListFailedTasksCommand.php index 0d80a7f4..7ceb01a6 100644 --- a/src/Command/ListFailedTasksCommand.php +++ b/src/Command/ListFailedTasksCommand.php @@ -25,7 +25,7 @@ )] final class ListFailedTasksCommand extends Command { - public function __construct(private WorkerInterface $worker) + public function __construct(private readonly WorkerInterface $worker) { parent::__construct(); } diff --git a/src/Command/ListTasksCommand.php b/src/Command/ListTasksCommand.php index c79848a4..2b93bf09 100644 --- a/src/Command/ListTasksCommand.php +++ b/src/Command/ListTasksCommand.php @@ -39,7 +39,7 @@ final class ListTasksCommand extends Command /** * {@inheritdoc} */ - public function __construct(private SchedulerInterface $scheduler) + public function __construct(private readonly SchedulerInterface $scheduler) { parent::__construct(); } diff --git a/src/Command/RebootSchedulerCommand.php b/src/Command/RebootSchedulerCommand.php index 801016b3..573a1aea 100644 --- a/src/Command/RebootSchedulerCommand.php +++ b/src/Command/RebootSchedulerCommand.php @@ -32,16 +32,12 @@ )] final class RebootSchedulerCommand extends Command { - private LoggerInterface $logger; - public function __construct( - private SchedulerInterface $scheduler, - private WorkerInterface $worker, - private EventDispatcherInterface $eventDispatcher, - ?LoggerInterface $logger = null + private readonly SchedulerInterface $scheduler, + private readonly WorkerInterface $worker, + private readonly EventDispatcherInterface $eventDispatcher, + private readonly LoggerInterface $logger = new NullLogger() ) { - $this->logger = $logger ?? new NullLogger(); - parent::__construct(); } diff --git a/src/Command/RemoveFailedTaskCommand.php b/src/Command/RemoveFailedTaskCommand.php index 3724eeef..a81fff9b 100644 --- a/src/Command/RemoveFailedTaskCommand.php +++ b/src/Command/RemoveFailedTaskCommand.php @@ -31,8 +31,8 @@ final class RemoveFailedTaskCommand extends Command { public function __construct( - private SchedulerInterface $scheduler, - private WorkerInterface $worker + private readonly SchedulerInterface $scheduler, + private readonly WorkerInterface $worker ) { parent::__construct(); } diff --git a/src/Command/RetryFailedTaskCommand.php b/src/Command/RetryFailedTaskCommand.php index 1ed0e464..4bf086c7 100644 --- a/src/Command/RetryFailedTaskCommand.php +++ b/src/Command/RetryFailedTaskCommand.php @@ -34,11 +34,11 @@ )] final class RetryFailedTaskCommand extends Command { - private LoggerInterface $logger; + private readonly LoggerInterface $logger; public function __construct( - private WorkerInterface $worker, - private EventDispatcherInterface $eventDispatcher, + private readonly WorkerInterface $worker, + private readonly EventDispatcherInterface $eventDispatcher, LoggerInterface $logger = null ) { $this->logger = $logger ?? new NullLogger(); diff --git a/src/Command/YieldTaskCommand.php b/src/Command/YieldTaskCommand.php index d83d1781..af07a5da 100644 --- a/src/Command/YieldTaskCommand.php +++ b/src/Command/YieldTaskCommand.php @@ -27,7 +27,7 @@ )] final class YieldTaskCommand extends Command { - public function __construct(private SchedulerInterface $scheduler) + public function __construct(private readonly SchedulerInterface $scheduler) { parent::__construct(); } diff --git a/src/DataCollector/SchedulerDataCollector.php b/src/DataCollector/SchedulerDataCollector.php index c7a90d3c..f5d74e3f 100644 --- a/src/DataCollector/SchedulerDataCollector.php +++ b/src/DataCollector/SchedulerDataCollector.php @@ -25,11 +25,11 @@ final class SchedulerDataCollector extends DataCollector implements LateDataColl */ public const NAME = 'scheduler'; - private TaskEventList $events; + private readonly TaskEventList $events; public function __construct( TaskLoggerSubscriber $taskLoggerSubscriber, - private ?ProbeInterface $probe = null + private readonly ?ProbeInterface $probe = null ) { $this->events = $taskLoggerSubscriber->getEvents(); } diff --git a/src/DependencyInjection/SchedulerPass.php b/src/DependencyInjection/SchedulerPass.php index 23de8600..08dda006 100644 --- a/src/DependencyInjection/SchedulerPass.php +++ b/src/DependencyInjection/SchedulerPass.php @@ -17,8 +17,8 @@ final class SchedulerPass implements CompilerPassInterface { public function __construct( - private string $schedulerExtraTag = 'scheduler.extra', - private string $schedulerEntryPointTag = 'scheduler.entry_point' + private readonly string $schedulerExtraTag = 'scheduler.extra', + private readonly string $schedulerEntryPointTag = 'scheduler.entry_point' ) { } diff --git a/src/Event/SchedulerRebootedEvent.php b/src/Event/SchedulerRebootedEvent.php index fd8d401d..3943f46a 100644 --- a/src/Event/SchedulerRebootedEvent.php +++ b/src/Event/SchedulerRebootedEvent.php @@ -12,7 +12,7 @@ */ final class SchedulerRebootedEvent extends Event { - public function __construct(private SchedulerInterface $scheduler) + public function __construct(private readonly SchedulerInterface $scheduler) { } diff --git a/src/Event/TaskExecutedEvent.php b/src/Event/TaskExecutedEvent.php index d595eaf6..40546dd9 100644 --- a/src/Event/TaskExecutedEvent.php +++ b/src/Event/TaskExecutedEvent.php @@ -13,7 +13,7 @@ */ final class TaskExecutedEvent extends Event implements TaskEventInterface { - public function __construct(private TaskInterface $task, private Output $output) + public function __construct(private readonly TaskInterface $task, private readonly Output $output) { } diff --git a/src/Event/TaskExecutingEvent.php b/src/Event/TaskExecutingEvent.php index 21fa9db5..cb47cf56 100644 --- a/src/Event/TaskExecutingEvent.php +++ b/src/Event/TaskExecutingEvent.php @@ -14,7 +14,7 @@ */ final class TaskExecutingEvent extends Event implements TaskEventInterface, WorkerEventInterface { - public function __construct(private TaskInterface $task, private WorkerInterface $worker, private TaskListInterface $currentTasks) + public function __construct(private readonly TaskInterface $task, private readonly WorkerInterface $worker, private readonly TaskListInterface $currentTasks) { } diff --git a/src/Event/TaskFailedEvent.php b/src/Event/TaskFailedEvent.php index 7c7fd142..b8518b67 100644 --- a/src/Event/TaskFailedEvent.php +++ b/src/Event/TaskFailedEvent.php @@ -12,7 +12,7 @@ */ final class TaskFailedEvent extends Event implements TaskEventInterface { - public function __construct(private FailedTask $task) + public function __construct(private readonly FailedTask $task) { } diff --git a/src/Event/TaskScheduledEvent.php b/src/Event/TaskScheduledEvent.php index 7893b21f..1fbd4702 100644 --- a/src/Event/TaskScheduledEvent.php +++ b/src/Event/TaskScheduledEvent.php @@ -12,7 +12,7 @@ */ final class TaskScheduledEvent extends Event implements TaskEventInterface { - public function __construct(private TaskInterface $task) + public function __construct(private readonly TaskInterface $task) { } diff --git a/src/Event/TaskUnscheduledEvent.php b/src/Event/TaskUnscheduledEvent.php index fc214dbb..b17b7fe0 100644 --- a/src/Event/TaskUnscheduledEvent.php +++ b/src/Event/TaskUnscheduledEvent.php @@ -11,7 +11,7 @@ */ final class TaskUnscheduledEvent extends Event implements TaskEventInterface { - public function __construct(private string $task) + public function __construct(private readonly string $task) { } diff --git a/src/Event/WorkerForkedEvent.php b/src/Event/WorkerForkedEvent.php index 35ca24c5..081fa3b3 100644 --- a/src/Event/WorkerForkedEvent.php +++ b/src/Event/WorkerForkedEvent.php @@ -12,7 +12,7 @@ */ final class WorkerForkedEvent extends Event { - public function __construct(private WorkerInterface $forkedWorker, private WorkerInterface $newWorker) + public function __construct(private readonly WorkerInterface $forkedWorker, private readonly WorkerInterface $newWorker) { } diff --git a/src/Event/WorkerPausedEvent.php b/src/Event/WorkerPausedEvent.php index 80b7c6fa..cf89306c 100644 --- a/src/Event/WorkerPausedEvent.php +++ b/src/Event/WorkerPausedEvent.php @@ -12,7 +12,7 @@ */ final class WorkerPausedEvent extends Event { - public function __construct(private WorkerInterface $worker) + public function __construct(private readonly WorkerInterface $worker) { } diff --git a/src/Event/WorkerRestartedEvent.php b/src/Event/WorkerRestartedEvent.php index 340bac95..9ccce7c2 100644 --- a/src/Event/WorkerRestartedEvent.php +++ b/src/Event/WorkerRestartedEvent.php @@ -12,7 +12,7 @@ */ final class WorkerRestartedEvent extends Event { - public function __construct(private WorkerInterface $worker) + public function __construct(private readonly WorkerInterface $worker) { } diff --git a/src/Event/WorkerRunningEvent.php b/src/Event/WorkerRunningEvent.php index bc67e0f0..20ae1434 100644 --- a/src/Event/WorkerRunningEvent.php +++ b/src/Event/WorkerRunningEvent.php @@ -12,7 +12,7 @@ */ final class WorkerRunningEvent extends Event implements WorkerEventInterface { - public function __construct(private WorkerInterface $worker, private bool $isIdle = false) + public function __construct(private readonly WorkerInterface $worker, private readonly bool $isIdle = false) { } diff --git a/src/Event/WorkerSleepingEvent.php b/src/Event/WorkerSleepingEvent.php index c8fb3518..d517eab3 100644 --- a/src/Event/WorkerSleepingEvent.php +++ b/src/Event/WorkerSleepingEvent.php @@ -12,7 +12,7 @@ */ final class WorkerSleepingEvent extends Event implements WorkerEventInterface { - public function __construct(private int $sleepDuration, private WorkerInterface $worker) + public function __construct(private readonly int $sleepDuration, private readonly WorkerInterface $worker) { } diff --git a/src/Event/WorkerStartedEvent.php b/src/Event/WorkerStartedEvent.php index 5ab07a4e..0ac13fab 100644 --- a/src/Event/WorkerStartedEvent.php +++ b/src/Event/WorkerStartedEvent.php @@ -12,7 +12,7 @@ */ final class WorkerStartedEvent extends Event implements WorkerEventInterface { - public function __construct(private WorkerInterface $worker) + public function __construct(private readonly WorkerInterface $worker) { } diff --git a/src/Event/WorkerStoppedEvent.php b/src/Event/WorkerStoppedEvent.php index 642916ed..b304769d 100644 --- a/src/Event/WorkerStoppedEvent.php +++ b/src/Event/WorkerStoppedEvent.php @@ -12,7 +12,7 @@ */ final class WorkerStoppedEvent extends Event { - public function __construct(private WorkerInterface $worker) + public function __construct(private readonly WorkerInterface $worker) { } diff --git a/src/EventListener/ProbeStateSubscriber.php b/src/EventListener/ProbeStateSubscriber.php index acbad8e9..b2daa696 100644 --- a/src/EventListener/ProbeStateSubscriber.php +++ b/src/EventListener/ProbeStateSubscriber.php @@ -19,7 +19,7 @@ */ final class ProbeStateSubscriber implements EventSubscriberInterface { - public function __construct(private ProbeInterface $probe, private string $path = '/_probe') + public function __construct(private readonly ProbeInterface $probe, private readonly string $path = '/_probe') { } diff --git a/src/EventListener/StopWorkerOnFailureLimitSubscriber.php b/src/EventListener/StopWorkerOnFailureLimitSubscriber.php index 680b8e68..ffe5e75f 100644 --- a/src/EventListener/StopWorkerOnFailureLimitSubscriber.php +++ b/src/EventListener/StopWorkerOnFailureLimitSubscriber.php @@ -17,15 +17,12 @@ */ final class StopWorkerOnFailureLimitSubscriber implements EventSubscriberInterface { - private LoggerInterface $logger; private int $failedTasks = 0; public function __construct( - private int $maximumFailedTasks, - ?LoggerInterface $logger = null + private readonly int $maximumFailedTasks, + private readonly LoggerInterface $logger = new NullLogger() ) { - $this->logger = $logger ?? new NullLogger(); - if ($maximumFailedTasks <= 0) { throw new InvalidArgumentException(sprintf('The failure limit must be greater than 0, given %d', $maximumFailedTasks)); } diff --git a/src/EventListener/StopWorkerOnSignalSubscriber.php b/src/EventListener/StopWorkerOnSignalSubscriber.php index f1c3a30c..8793864e 100644 --- a/src/EventListener/StopWorkerOnSignalSubscriber.php +++ b/src/EventListener/StopWorkerOnSignalSubscriber.php @@ -26,11 +26,8 @@ */ final class StopWorkerOnSignalSubscriber implements EventSubscriberInterface { - private LoggerInterface $logger; - - public function __construct(?LoggerInterface $logger = null) + public function __construct(private readonly LoggerInterface $logger = new NullLogger()) { - $this->logger = $logger ?? new NullLogger(); } public function onTaskExecuting(TaskExecutingEvent $taskExecutingEvent): void diff --git a/src/EventListener/StopWorkerOnTaskLimitSubscriber.php b/src/EventListener/StopWorkerOnTaskLimitSubscriber.php index 9eaa3415..7c27c3a9 100644 --- a/src/EventListener/StopWorkerOnTaskLimitSubscriber.php +++ b/src/EventListener/StopWorkerOnTaskLimitSubscriber.php @@ -15,13 +15,9 @@ final class StopWorkerOnTaskLimitSubscriber implements EventSubscriberInterface { private int $consumedTasks = 0; - private LoggerInterface $logger; - public function __construct( - private int $maximumTasks, - ?LoggerInterface $logger = null - ) { - $this->logger = $logger ?? new NullLogger(); + public function __construct(private readonly int $maximumTasks, private readonly LoggerInterface $logger = new NullLogger()) + { } public function onWorkerRunning(WorkerRunningEvent $workerRunningEvent): void diff --git a/src/EventListener/StopWorkerOnTimeLimitSubscriber.php b/src/EventListener/StopWorkerOnTimeLimitSubscriber.php index 2961b024..8645ac0c 100644 --- a/src/EventListener/StopWorkerOnTimeLimitSubscriber.php +++ b/src/EventListener/StopWorkerOnTimeLimitSubscriber.php @@ -19,13 +19,9 @@ final class StopWorkerOnTimeLimitSubscriber implements EventSubscriberInterface { private ?float $endTime = null; - private LoggerInterface $logger; - public function __construct( - private int $timeLimitInSeconds, - ?LoggerInterface $logger = null - ) { - $this->logger = $logger ?? new NullLogger(); + public function __construct(private readonly int $timeLimitInSeconds, private readonly LoggerInterface $logger = new NullLogger()) + { } public function onWorkerStarted(): void diff --git a/src/EventListener/TaskLifecycleSubscriber.php b/src/EventListener/TaskLifecycleSubscriber.php index 595ebe48..b44eacdd 100644 --- a/src/EventListener/TaskLifecycleSubscriber.php +++ b/src/EventListener/TaskLifecycleSubscriber.php @@ -17,7 +17,7 @@ */ final class TaskLifecycleSubscriber implements EventSubscriberInterface { - private LoggerInterface $logger; + private readonly LoggerInterface $logger; public function __construct(LoggerInterface $logger = null) { diff --git a/src/EventListener/TaskLoggerSubscriber.php b/src/EventListener/TaskLoggerSubscriber.php index ab5bbc75..0e083ea1 100644 --- a/src/EventListener/TaskLoggerSubscriber.php +++ b/src/EventListener/TaskLoggerSubscriber.php @@ -18,7 +18,7 @@ */ final class TaskLoggerSubscriber implements EventSubscriberInterface { - private TaskEventList $events; + private readonly TaskEventList $events; public function __construct() { diff --git a/src/Expression/ExpressionBuilder.php b/src/Expression/ExpressionBuilder.php index b4a99a97..2fa24140 100644 --- a/src/Expression/ExpressionBuilder.php +++ b/src/Expression/ExpressionBuilder.php @@ -15,7 +15,7 @@ final class ExpressionBuilder implements BuilderInterface /** * @param iterable|ExpressionBuilderInterface[] $builders */ - public function __construct(private iterable $builders) + public function __construct(private readonly iterable $builders) { } diff --git a/src/Fiber/AbstractFiberHandler.php b/src/Fiber/AbstractFiberHandler.php index b26f9e7a..e3d2242a 100644 --- a/src/Fiber/AbstractFiberHandler.php +++ b/src/Fiber/AbstractFiberHandler.php @@ -16,7 +16,7 @@ */ abstract class AbstractFiberHandler { - private LoggerInterface $logger; + private readonly LoggerInterface $logger; public function __construct(?LoggerInterface $logger = null) { diff --git a/src/HttpScheduler.php b/src/HttpScheduler.php index 270a3c84..8f23edaa 100644 --- a/src/HttpScheduler.php +++ b/src/HttpScheduler.php @@ -24,9 +24,9 @@ final class HttpScheduler implements SchedulerInterface { public function __construct( - private string $externalSchedulerEndpoint, - private SerializerInterface $serializer, - private HttpClientInterface $httpClient + private readonly string $externalSchedulerEndpoint, + private readonly SerializerInterface $serializer, + private readonly HttpClientInterface $httpClient ) { } diff --git a/src/LazyScheduler.php b/src/LazyScheduler.php index d895bcdc..72068b94 100644 --- a/src/LazyScheduler.php +++ b/src/LazyScheduler.php @@ -20,7 +20,7 @@ final class LazyScheduler implements SchedulerInterface, LazyInterface private SchedulerInterface $scheduler; private bool $initialized = false; - public function __construct(private SchedulerInterface $sourceScheduler) + public function __construct(private readonly SchedulerInterface $sourceScheduler) { } diff --git a/src/Messenger/TaskToExecuteMessage.php b/src/Messenger/TaskToExecuteMessage.php index fbb64ac5..168a4132 100644 --- a/src/Messenger/TaskToExecuteMessage.php +++ b/src/Messenger/TaskToExecuteMessage.php @@ -12,8 +12,8 @@ final class TaskToExecuteMessage { public function __construct( - private TaskInterface $task, - private int $workerTimeout = 1 + private readonly TaskInterface $task, + private readonly int $workerTimeout = 1 ) { } diff --git a/src/Messenger/TaskToPauseMessage.php b/src/Messenger/TaskToPauseMessage.php index 2dc52e19..c37d7a65 100644 --- a/src/Messenger/TaskToPauseMessage.php +++ b/src/Messenger/TaskToPauseMessage.php @@ -9,7 +9,7 @@ */ final class TaskToPauseMessage { - public function __construct(private string $task) + public function __construct(private readonly string $task) { } diff --git a/src/Messenger/TaskToUpdateMessage.php b/src/Messenger/TaskToUpdateMessage.php index af7641b9..1625f6c9 100644 --- a/src/Messenger/TaskToUpdateMessage.php +++ b/src/Messenger/TaskToUpdateMessage.php @@ -11,7 +11,7 @@ */ final class TaskToUpdateMessage { - public function __construct(private string $taskName, private TaskInterface $task) + public function __construct(private readonly string $taskName, private readonly TaskInterface $task) { } diff --git a/src/Messenger/TaskToYieldMessage.php b/src/Messenger/TaskToYieldMessage.php index 92c8cbd6..05216d1e 100644 --- a/src/Messenger/TaskToYieldMessage.php +++ b/src/Messenger/TaskToYieldMessage.php @@ -9,7 +9,7 @@ */ final class TaskToYieldMessage { - public function __construct(private string $name) + public function __construct(private readonly string $name) { } diff --git a/src/Middleware/AbstractMiddlewareStack.php b/src/Middleware/AbstractMiddlewareStack.php index 16885eef..78dc641e 100644 --- a/src/Middleware/AbstractMiddlewareStack.php +++ b/src/Middleware/AbstractMiddlewareStack.php @@ -15,12 +15,12 @@ */ abstract class AbstractMiddlewareStack implements MiddlewareStackInterface { - private MiddlewareRegistryInterface $middlewareRegistry; + private readonly MiddlewareRegistryInterface $middlewareRegistry; /** * @var SplObjectStorage */ - private SplObjectStorage $executedMiddleware; + private readonly SplObjectStorage $executedMiddleware; /** * @param iterable|PreExecutionMiddlewareInterface[]|PostExecutionMiddlewareInterface[]|PreSchedulingMiddlewareInterface[]|PostSchedulingMiddlewareInterface[]|OrderedMiddlewareInterface[] $stack diff --git a/src/Middleware/FiberAwareSchedulerMiddlewareStack.php b/src/Middleware/FiberAwareSchedulerMiddlewareStack.php index 7f110e08..15fd0d90 100644 --- a/src/Middleware/FiberAwareSchedulerMiddlewareStack.php +++ b/src/Middleware/FiberAwareSchedulerMiddlewareStack.php @@ -16,7 +16,7 @@ final class FiberAwareSchedulerMiddlewareStack extends AbstractFiberHandler implements SchedulerMiddlewareStackInterface { public function __construct( - private SchedulerMiddlewareStackInterface $middlewareStack, + private readonly SchedulerMiddlewareStackInterface $middlewareStack, ?LoggerInterface $logger = null ) { parent::__construct(logger: $logger); diff --git a/src/Middleware/FiberAwareWorkerMiddlewareStack.php b/src/Middleware/FiberAwareWorkerMiddlewareStack.php index 374e01f8..ae147412 100644 --- a/src/Middleware/FiberAwareWorkerMiddlewareStack.php +++ b/src/Middleware/FiberAwareWorkerMiddlewareStack.php @@ -16,7 +16,7 @@ final class FiberAwareWorkerMiddlewareStack extends AbstractFiberHandler implements WorkerMiddlewareStackInterface { public function __construct( - private WorkerMiddlewareStackInterface $middlewareStack, + private readonly WorkerMiddlewareStackInterface $middlewareStack, ?LoggerInterface $logger = null ) { parent::__construct(logger: $logger); diff --git a/src/Middleware/MaxExecutionMiddleware.php b/src/Middleware/MaxExecutionMiddleware.php index 993b3073..90a33ec7 100644 --- a/src/Middleware/MaxExecutionMiddleware.php +++ b/src/Middleware/MaxExecutionMiddleware.php @@ -19,13 +19,8 @@ */ final class MaxExecutionMiddleware implements PreExecutionMiddlewareInterface, PostExecutionMiddlewareInterface { - private LoggerInterface $logger; - - public function __construct( - private ?RateLimiterFactory $rateLimiter = null, - ?LoggerInterface $logger = null - ) { - $this->logger = $logger ?? new NullLogger(); + public function __construct(private readonly ?RateLimiterFactory $rateLimiter = null, private readonly LoggerInterface $logger = new NullLogger()) + { } public function preExecute(TaskInterface $task): void diff --git a/src/Middleware/NotifierMiddleware.php b/src/Middleware/NotifierMiddleware.php index b0b355f5..f28b56d9 100644 --- a/src/Middleware/NotifierMiddleware.php +++ b/src/Middleware/NotifierMiddleware.php @@ -17,7 +17,7 @@ */ final class NotifierMiddleware implements PreSchedulingMiddlewareInterface, PostSchedulingMiddlewareInterface, PreExecutionMiddlewareInterface, PostExecutionMiddlewareInterface, OrderedMiddlewareInterface { - public function __construct(private ?NotifierInterface $notifier = null) + public function __construct(private readonly ?NotifierInterface $notifier = null) { } diff --git a/src/Middleware/SingleRunTaskMiddleware.php b/src/Middleware/SingleRunTaskMiddleware.php index a6270a17..7300cef9 100644 --- a/src/Middleware/SingleRunTaskMiddleware.php +++ b/src/Middleware/SingleRunTaskMiddleware.php @@ -17,13 +17,8 @@ */ final class SingleRunTaskMiddleware implements PostExecutionMiddlewareInterface, OrderedMiddlewareInterface, RequiredMiddlewareInterface { - private LoggerInterface $logger; - - public function __construct( - private TransportInterface $transport, - ?LoggerInterface $logger = null - ) { - $this->logger = $logger ?? new NullLogger(); + public function __construct(private readonly TransportInterface $transport, private readonly LoggerInterface $logger = new NullLogger()) + { } /** diff --git a/src/Middleware/TaskLockBagMiddleware.php b/src/Middleware/TaskLockBagMiddleware.php index 0cb85535..2e41645d 100644 --- a/src/Middleware/TaskLockBagMiddleware.php +++ b/src/Middleware/TaskLockBagMiddleware.php @@ -22,13 +22,8 @@ final class TaskLockBagMiddleware implements PostExecutionMiddlewareInterface, O { private const TASK_LOCK_MASK = '_symfony_scheduler_foo_'; - private LoggerInterface $logger; - - public function __construct( - private LockFactory $lockFactory, - ?LoggerInterface $logger = null - ) { - $this->logger = $logger ?? new NullLogger(); + public function __construct(private readonly LockFactory $lockFactory, private readonly LoggerInterface $logger = new NullLogger()) + { } /** diff --git a/src/Middleware/TaskUpdateMiddleware.php b/src/Middleware/TaskUpdateMiddleware.php index 7232de63..b4ddcb7d 100644 --- a/src/Middleware/TaskUpdateMiddleware.php +++ b/src/Middleware/TaskUpdateMiddleware.php @@ -13,7 +13,7 @@ */ final class TaskUpdateMiddleware implements PostExecutionMiddlewareInterface, OrderedMiddlewareInterface, RequiredMiddlewareInterface { - public function __construct(private TransportInterface $transport) + public function __construct(private readonly TransportInterface $transport) { } diff --git a/src/Pool/Configuration/SchedulerConfiguration.php b/src/Pool/Configuration/SchedulerConfiguration.php index 4fc5b64a..55b6044e 100644 --- a/src/Pool/Configuration/SchedulerConfiguration.php +++ b/src/Pool/Configuration/SchedulerConfiguration.php @@ -15,11 +15,11 @@ */ final class SchedulerConfiguration { - private TaskListInterface $dueTasks; + private readonly TaskListInterface $dueTasks; public function __construct( - private DateTimeZone $timezone, - private DateTimeImmutable $synchronizedDate, + private readonly DateTimeZone $timezone, + private readonly DateTimeImmutable $synchronizedDate, TaskInterface ...$dueTasks ) { $this->dueTasks = new TaskList(tasks: $dueTasks); diff --git a/src/Probe/Probe.php b/src/Probe/Probe.php index d266074f..56842cb1 100644 --- a/src/Probe/Probe.php +++ b/src/Probe/Probe.php @@ -16,8 +16,8 @@ final class Probe implements ProbeInterface { public function __construct( - private SchedulerInterface $scheduler, - private WorkerInterface $worker + private readonly SchedulerInterface $scheduler, + private readonly WorkerInterface $worker ) { } diff --git a/src/Runner/CommandTaskRunner.php b/src/Runner/CommandTaskRunner.php index 5f386ef4..4b268ac4 100644 --- a/src/Runner/CommandTaskRunner.php +++ b/src/Runner/CommandTaskRunner.php @@ -23,7 +23,7 @@ */ final class CommandTaskRunner implements RunnerInterface { - public function __construct(private Application $application) + public function __construct(private readonly Application $application) { } @@ -80,7 +80,7 @@ private function buildOptions(CommandTask $commandTask): array $options = []; foreach ($commandTask->getOptions() as $key => $option) { if (is_int($key)) { - $options[] = str_starts_with($option, '--') ? $option : sprintf('--%s', $option); + $options[] = str_starts_with((string) $option, '--') ? $option : sprintf('--%s', $option); continue; } diff --git a/src/Runner/HttpTaskRunner.php b/src/Runner/HttpTaskRunner.php index fed22881..baf3bb3e 100644 --- a/src/Runner/HttpTaskRunner.php +++ b/src/Runner/HttpTaskRunner.php @@ -17,7 +17,7 @@ */ final class HttpTaskRunner implements RunnerInterface { - private HttpClientInterface $httpClient; + private readonly HttpClientInterface $httpClient; public function __construct(HttpClientInterface $httpClient = null) { diff --git a/src/Runner/MessengerTaskRunner.php b/src/Runner/MessengerTaskRunner.php index f0d16d29..d78d9824 100644 --- a/src/Runner/MessengerTaskRunner.php +++ b/src/Runner/MessengerTaskRunner.php @@ -16,7 +16,7 @@ */ final class MessengerTaskRunner implements RunnerInterface { - public function __construct(private ?MessageBusInterface $bus = null) + public function __construct(private readonly ?MessageBusInterface $bus = null) { } diff --git a/src/Runner/NotificationTaskRunner.php b/src/Runner/NotificationTaskRunner.php index 14d5143e..393bdee1 100644 --- a/src/Runner/NotificationTaskRunner.php +++ b/src/Runner/NotificationTaskRunner.php @@ -16,7 +16,7 @@ */ final class NotificationTaskRunner implements RunnerInterface { - public function __construct(private ?NotifierInterface $notifier = null) + public function __construct(private readonly ?NotifierInterface $notifier = null) { } diff --git a/src/Runner/ProbeTaskRunner.php b/src/Runner/ProbeTaskRunner.php index 4401ce93..f97d0cea 100644 --- a/src/Runner/ProbeTaskRunner.php +++ b/src/Runner/ProbeTaskRunner.php @@ -19,7 +19,7 @@ */ final class ProbeTaskRunner implements RunnerInterface { - private HttpClientInterface $httpClient; + private readonly HttpClientInterface $httpClient; public function __construct(?HttpClientInterface $httpClient = null) { diff --git a/src/Runner/RunnerRegistry.php b/src/Runner/RunnerRegistry.php index 297ebd20..915cabd3 100644 --- a/src/Runner/RunnerRegistry.php +++ b/src/Runner/RunnerRegistry.php @@ -22,7 +22,7 @@ final class RunnerRegistry implements RunnerRegistryInterface /** * @var RunnerInterface[] */ - private array $runners; + private readonly array $runners; /** * @param RunnerInterface[] $runners diff --git a/src/SchedulePolicy/SchedulePolicyOrchestrator.php b/src/SchedulePolicy/SchedulePolicyOrchestrator.php index bbc77f2d..da1f10d4 100644 --- a/src/SchedulePolicy/SchedulePolicyOrchestrator.php +++ b/src/SchedulePolicy/SchedulePolicyOrchestrator.php @@ -19,7 +19,7 @@ final class SchedulePolicyOrchestrator implements SchedulePolicyOrchestratorInte /** * @param PolicyInterface[] $policies */ - public function __construct(private iterable $policies) + public function __construct(private readonly iterable $policies) { } diff --git a/src/Serializer/AccessLockBagNormalizer.php b/src/Serializer/AccessLockBagNormalizer.php index 0184369b..9f8c2ee0 100644 --- a/src/Serializer/AccessLockBagNormalizer.php +++ b/src/Serializer/AccessLockBagNormalizer.php @@ -21,13 +21,8 @@ */ final class AccessLockBagNormalizer implements NormalizerInterface, DenormalizerInterface { - private LoggerInterface $logger; - - public function __construct( - private ObjectNormalizer|NormalizerInterface|DenormalizerInterface $objectNormalizer, - ?LoggerInterface $logger = null - ) { - $this->logger = $logger ?? new NullLogger(); + public function __construct(private readonly ObjectNormalizer|NormalizerInterface|DenormalizerInterface $objectNormalizer, private readonly LoggerInterface $logger = new NullLogger()) + { } /** diff --git a/src/Serializer/NotificationTaskBagNormalizer.php b/src/Serializer/NotificationTaskBagNormalizer.php index 188fb76f..2896c3cc 100644 --- a/src/Serializer/NotificationTaskBagNormalizer.php +++ b/src/Serializer/NotificationTaskBagNormalizer.php @@ -21,7 +21,7 @@ */ final class NotificationTaskBagNormalizer implements DenormalizerInterface, NormalizerInterface { - public function __construct(private DenormalizerInterface|NormalizerInterface|ObjectNormalizer $objectNormalizer) + public function __construct(private readonly DenormalizerInterface|NormalizerInterface|ObjectNormalizer $objectNormalizer) { } diff --git a/src/Serializer/SchedulerConfigurationNormalizer.php b/src/Serializer/SchedulerConfigurationNormalizer.php index 2658e165..35f3119a 100644 --- a/src/Serializer/SchedulerConfigurationNormalizer.php +++ b/src/Serializer/SchedulerConfigurationNormalizer.php @@ -23,10 +23,10 @@ final class SchedulerConfigurationNormalizer implements NormalizerInterface, DenormalizerInterface { public function __construct( - private DenormalizerInterface|NormalizerInterface|TaskNormalizer $taskNormalizer, - private DenormalizerInterface|NormalizerInterface|DateTimeZoneNormalizer $dateTimeZoneNormalizer, - private DenormalizerInterface|NormalizerInterface|DateTimeNormalizer $dateTimeNormalizer, - private DenormalizerInterface|NormalizerInterface|ObjectNormalizer $objectNormalizer + private readonly DenormalizerInterface|NormalizerInterface|TaskNormalizer $taskNormalizer, + private readonly DenormalizerInterface|NormalizerInterface|DateTimeZoneNormalizer $dateTimeZoneNormalizer, + private readonly DenormalizerInterface|NormalizerInterface|DateTimeNormalizer $dateTimeNormalizer, + private readonly DenormalizerInterface|NormalizerInterface|ObjectNormalizer $objectNormalizer ) { } diff --git a/src/Serializer/TaskNormalizer.php b/src/Serializer/TaskNormalizer.php index e3f8b9d2..b9ee3981 100644 --- a/src/Serializer/TaskNormalizer.php +++ b/src/Serializer/TaskNormalizer.php @@ -52,12 +52,12 @@ final class TaskNormalizer implements DenormalizerInterface, NormalizerInterface private const NORMALIZATION_DISCRIMINATOR = 'taskInternalType'; public function __construct( - private DenormalizerInterface|NormalizerInterface|DateTimeNormalizer $dateTimeNormalizer, - private DenormalizerInterface|NormalizerInterface|DateTimeZoneNormalizer $dateTimeZoneNormalizer, - private DenormalizerInterface|NormalizerInterface|DateIntervalNormalizer $dateIntervalNormalizer, - private DenormalizerInterface|NormalizerInterface|ObjectNormalizer $objectNormalizer, - private DenormalizerInterface|NormalizerInterface|NotificationTaskBagNormalizer $notificationTaskBagNormalizer, - private DenormalizerInterface|NormalizerInterface|AccessLockBagNormalizer $accessLockBagNormalizer + private readonly DenormalizerInterface|NormalizerInterface|DateTimeNormalizer $dateTimeNormalizer, + private readonly DenormalizerInterface|NormalizerInterface|DateTimeZoneNormalizer $dateTimeZoneNormalizer, + private readonly DenormalizerInterface|NormalizerInterface|DateIntervalNormalizer $dateIntervalNormalizer, + private readonly DenormalizerInterface|NormalizerInterface|ObjectNormalizer $objectNormalizer, + private readonly DenormalizerInterface|NormalizerInterface|NotificationTaskBagNormalizer $notificationTaskBagNormalizer, + private readonly DenormalizerInterface|NormalizerInterface|AccessLockBagNormalizer $accessLockBagNormalizer ) { } diff --git a/src/Task/Builder/AbstractTaskBuilder.php b/src/Task/Builder/AbstractTaskBuilder.php index 8c11b16c..6786f147 100644 --- a/src/Task/Builder/AbstractTaskBuilder.php +++ b/src/Task/Builder/AbstractTaskBuilder.php @@ -14,7 +14,7 @@ */ abstract class AbstractTaskBuilder { - public function __construct(private ExpressionBuilderInterface $expressionBuilder) + public function __construct(private readonly ExpressionBuilderInterface $expressionBuilder) { } diff --git a/src/Task/FailedTask.php b/src/Task/FailedTask.php index 3b547653..c63c192e 100644 --- a/src/Task/FailedTask.php +++ b/src/Task/FailedTask.php @@ -12,9 +12,9 @@ */ final class FailedTask extends AbstractTask { - private DateTimeImmutable $failedAt; + private readonly DateTimeImmutable $failedAt; - public function __construct(private TaskInterface $task, private string $reason) + public function __construct(private readonly TaskInterface $task, private readonly string $reason) { $this->failedAt = new DateTimeImmutable(); diff --git a/src/Task/LazyTask.php b/src/Task/LazyTask.php index ea5d79d0..b4d4042e 100644 --- a/src/Task/LazyTask.php +++ b/src/Task/LazyTask.php @@ -14,7 +14,7 @@ final class LazyTask extends AbstractTask implements LazyInterface { private bool $initialized = false; - public function __construct(string $name, private Closure $sourceTaskClosure) + public function __construct(string $name, private readonly Closure $sourceTaskClosure) { parent::__construct(name: sprintf('%s.lazy', $name)); } diff --git a/src/Task/LazyTaskList.php b/src/Task/LazyTaskList.php index 576d5551..ef99e679 100644 --- a/src/Task/LazyTaskList.php +++ b/src/Task/LazyTaskList.php @@ -17,7 +17,7 @@ final class LazyTaskList implements TaskListInterface, LazyInterface private TaskListInterface $list; private bool $initialized = false; - public function __construct(private TaskListInterface $sourceList) + public function __construct(private readonly TaskListInterface $sourceList) { } diff --git a/src/Task/Output.php b/src/Task/Output.php index c90d4e95..4b43a6e1 100644 --- a/src/Task/Output.php +++ b/src/Task/Output.php @@ -22,9 +22,9 @@ final class Output implements Stringable public const ERROR = 'error'; public function __construct( - private TaskInterface $task, - private ?string $output = 'undefined', - private string $type = self::SUCCESS + private readonly TaskInterface $task, + private readonly ?string $output = 'undefined', + private readonly string $type = self::SUCCESS ) { } diff --git a/src/Task/TaskBuilder.php b/src/Task/TaskBuilder.php index 9fedf906..95aa2494 100644 --- a/src/Task/TaskBuilder.php +++ b/src/Task/TaskBuilder.php @@ -18,8 +18,8 @@ final class TaskBuilder implements TaskBuilderInterface * @param iterable|BuilderInterface[] $builders */ public function __construct( - private iterable $builders, - private PropertyAccessorInterface $propertyAccessor + private readonly iterable $builders, + private readonly PropertyAccessorInterface $propertyAccessor ) { } diff --git a/src/Task/TaskExecutionTracker.php b/src/Task/TaskExecutionTracker.php index 858f1b33..83a6d667 100644 --- a/src/Task/TaskExecutionTracker.php +++ b/src/Task/TaskExecutionTracker.php @@ -13,7 +13,7 @@ */ final class TaskExecutionTracker implements TaskExecutionTrackerInterface { - public function __construct(private Stopwatch $watch) + public function __construct(private readonly Stopwatch $watch) { } diff --git a/src/TaskBag/AccessLockBag.php b/src/TaskBag/AccessLockBag.php index 0e7118e8..0affb8d2 100644 --- a/src/TaskBag/AccessLockBag.php +++ b/src/TaskBag/AccessLockBag.php @@ -11,7 +11,7 @@ */ final class AccessLockBag implements TaskBagInterface { - public function __construct(private ?Key $key = null) + public function __construct(private readonly ?Key $key = null) { } diff --git a/src/TaskBag/NotificationTaskBag.php b/src/TaskBag/NotificationTaskBag.php index 92056763..c848e81b 100644 --- a/src/TaskBag/NotificationTaskBag.php +++ b/src/TaskBag/NotificationTaskBag.php @@ -15,10 +15,10 @@ final class NotificationTaskBag implements TaskBagInterface /** * @var Recipient[] */ - private array $recipients; + private readonly array $recipients; public function __construct( - private Notification $notification, + private readonly Notification $notification, Recipient ...$recipients ) { $this->recipients = $recipients; diff --git a/src/Test/Constraint/Probe/ProbeEnabled.php b/src/Test/Constraint/Probe/ProbeEnabled.php index 7316aca5..a9b6649e 100644 --- a/src/Test/Constraint/Probe/ProbeEnabled.php +++ b/src/Test/Constraint/Probe/ProbeEnabled.php @@ -12,7 +12,7 @@ */ final class ProbeEnabled extends Constraint { - public function __construct(private bool $expectedState) + public function __construct(private readonly bool $expectedState) { } diff --git a/src/Test/Constraint/Probe/ProbeExecutedTask.php b/src/Test/Constraint/Probe/ProbeExecutedTask.php index 78c85908..75eb0c13 100644 --- a/src/Test/Constraint/Probe/ProbeExecutedTask.php +++ b/src/Test/Constraint/Probe/ProbeExecutedTask.php @@ -13,7 +13,7 @@ */ final class ProbeExecutedTask extends Constraint { - public function __construct(private int $expectedCount) + public function __construct(private readonly int $expectedCount) { } diff --git a/src/Test/Constraint/Probe/ProbeFailedTask.php b/src/Test/Constraint/Probe/ProbeFailedTask.php index c428c4b8..f8bdea5f 100644 --- a/src/Test/Constraint/Probe/ProbeFailedTask.php +++ b/src/Test/Constraint/Probe/ProbeFailedTask.php @@ -13,7 +13,7 @@ */ final class ProbeFailedTask extends Constraint { - public function __construct(private int $expectedCount) + public function __construct(private readonly int $expectedCount) { } diff --git a/src/Test/Constraint/Probe/ProbeScheduledTask.php b/src/Test/Constraint/Probe/ProbeScheduledTask.php index dbd7fcb1..39b58d7d 100644 --- a/src/Test/Constraint/Probe/ProbeScheduledTask.php +++ b/src/Test/Constraint/Probe/ProbeScheduledTask.php @@ -13,7 +13,7 @@ */ final class ProbeScheduledTask extends Constraint { - public function __construct(private int $expectedCount) + public function __construct(private readonly int $expectedCount) { } diff --git a/src/Test/Constraint/Probe/ProbeState.php b/src/Test/Constraint/Probe/ProbeState.php index 358c245d..8ffa7173 100644 --- a/src/Test/Constraint/Probe/ProbeState.php +++ b/src/Test/Constraint/Probe/ProbeState.php @@ -17,7 +17,7 @@ final class ProbeState extends Constraint /** * @param array $expectedState */ - public function __construct(private array $expectedState) + public function __construct(private readonly array $expectedState) { } diff --git a/src/Test/Constraint/Scheduler/SchedulerDueTask.php b/src/Test/Constraint/Scheduler/SchedulerDueTask.php index 7143523f..921a3b20 100644 --- a/src/Test/Constraint/Scheduler/SchedulerDueTask.php +++ b/src/Test/Constraint/Scheduler/SchedulerDueTask.php @@ -13,7 +13,7 @@ */ final class SchedulerDueTask extends Constraint { - public function __construct(private int $expectedCount) + public function __construct(private readonly int $expectedCount) { } diff --git a/src/Test/Constraint/TaskExecuted.php b/src/Test/Constraint/TaskExecuted.php index 1ac87fe4..dc14e5ff 100644 --- a/src/Test/Constraint/TaskExecuted.php +++ b/src/Test/Constraint/TaskExecuted.php @@ -15,7 +15,7 @@ */ final class TaskExecuted extends Constraint { - public function __construct(private int $expectedCount) + public function __construct(private readonly int $expectedCount) { } diff --git a/src/Test/Constraint/TaskFailed.php b/src/Test/Constraint/TaskFailed.php index f8ac275e..c1752e2c 100644 --- a/src/Test/Constraint/TaskFailed.php +++ b/src/Test/Constraint/TaskFailed.php @@ -15,7 +15,7 @@ */ final class TaskFailed extends Constraint { - public function __construct(private int $expectedCount) + public function __construct(private readonly int $expectedCount) { } diff --git a/src/Test/Constraint/TaskQueued.php b/src/Test/Constraint/TaskQueued.php index be4b18ec..6eb2e68c 100644 --- a/src/Test/Constraint/TaskQueued.php +++ b/src/Test/Constraint/TaskQueued.php @@ -14,7 +14,7 @@ */ final class TaskQueued extends Constraint { - public function __construct(private int $expectedCount) + public function __construct(private readonly int $expectedCount) { } diff --git a/src/Test/Constraint/TaskScheduled.php b/src/Test/Constraint/TaskScheduled.php index 54f73f0a..af9b2248 100644 --- a/src/Test/Constraint/TaskScheduled.php +++ b/src/Test/Constraint/TaskScheduled.php @@ -14,7 +14,7 @@ */ final class TaskScheduled extends Constraint { - public function __construct(private int $expectedCount) + public function __construct(private readonly int $expectedCount) { } diff --git a/src/Test/Constraint/TaskUnscheduled.php b/src/Test/Constraint/TaskUnscheduled.php index 3c31f56b..7e5ff8f5 100644 --- a/src/Test/Constraint/TaskUnscheduled.php +++ b/src/Test/Constraint/TaskUnscheduled.php @@ -14,7 +14,7 @@ */ final class TaskUnscheduled extends Constraint { - public function __construct(private int $expectedCount) + public function __construct(private readonly int $expectedCount) { } diff --git a/src/Transport/AbstractCompoundTransportFactory.php b/src/Transport/AbstractCompoundTransportFactory.php index cce907dd..ed99c66c 100644 --- a/src/Transport/AbstractCompoundTransportFactory.php +++ b/src/Transport/AbstractCompoundTransportFactory.php @@ -47,6 +47,6 @@ protected function handleTransportDsn(string $delimiter, Dsn $dsn, iterable $tra } throw new InvalidArgumentException('The given dsn cannot be used to create a transport'); - }, explode($delimiter, $dsnList[0])); + }, explode($delimiter, (string) $dsnList[0])); } } diff --git a/src/Transport/CacheTransportFactory.php b/src/Transport/CacheTransportFactory.php index a34a1a6d..cb4aae4a 100644 --- a/src/Transport/CacheTransportFactory.php +++ b/src/Transport/CacheTransportFactory.php @@ -14,7 +14,7 @@ */ final class CacheTransportFactory implements TransportFactoryInterface { - public function __construct(private CacheItemPoolInterface $pool) + public function __construct(private readonly CacheItemPoolInterface $pool) { } diff --git a/src/Transport/Configuration/AbstractCompoundConfigurationFactory.php b/src/Transport/Configuration/AbstractCompoundConfigurationFactory.php index 64768049..60a0ce35 100644 --- a/src/Transport/Configuration/AbstractCompoundConfigurationFactory.php +++ b/src/Transport/Configuration/AbstractCompoundConfigurationFactory.php @@ -33,7 +33,7 @@ protected function handleCompoundConfiguration(string $delimiter, Dsn $dsn, iter throw new LogicException(sprintf('The %s configuration factory cannot create a configuration', static::class)); } - $finalDsnList = explode($delimiter, $dsnList[0]); + $finalDsnList = explode($delimiter, (string) $dsnList[0]); if ($dsnList[0] === $finalDsnList[0]) { throw new InvalidArgumentException('The embedded dsn cannot be used to create a configuration'); } diff --git a/src/Transport/Configuration/CacheConfiguration.php b/src/Transport/Configuration/CacheConfiguration.php index a13321b6..84bd769d 100644 --- a/src/Transport/Configuration/CacheConfiguration.php +++ b/src/Transport/Configuration/CacheConfiguration.php @@ -25,7 +25,7 @@ final class CacheConfiguration extends AbstractConfiguration * @param array $options */ public function __construct( - private CacheItemPoolInterface $pool, + private readonly CacheItemPoolInterface $pool, array $options = [] ) { $this->boot(); diff --git a/src/Transport/Configuration/ConfigurationFactory.php b/src/Transport/Configuration/ConfigurationFactory.php index 4819d761..5f3a86b6 100644 --- a/src/Transport/Configuration/ConfigurationFactory.php +++ b/src/Transport/Configuration/ConfigurationFactory.php @@ -18,7 +18,7 @@ final class ConfigurationFactory /** * @param ConfigurationFactoryInterface[] $factories */ - public function __construct(private iterable $factories) + public function __construct(private readonly iterable $factories) { } diff --git a/src/Transport/Configuration/FailOverConfiguration.php b/src/Transport/Configuration/FailOverConfiguration.php index 9be9c1f3..d1814b8e 100644 --- a/src/Transport/Configuration/FailOverConfiguration.php +++ b/src/Transport/Configuration/FailOverConfiguration.php @@ -17,7 +17,7 @@ final class FailOverConfiguration extends AbstractCompoundConfiguration /** * @var SplObjectStorage */ - private SplObjectStorage $failedConfigurations; + private readonly SplObjectStorage $failedConfigurations; public function __construct(ConfigurationRegistryInterface $configurationRegistry) { diff --git a/src/Transport/Configuration/FiberConfiguration.php b/src/Transport/Configuration/FiberConfiguration.php index 77bba057..41c6a7e6 100644 --- a/src/Transport/Configuration/FiberConfiguration.php +++ b/src/Transport/Configuration/FiberConfiguration.php @@ -14,11 +14,8 @@ */ final class FiberConfiguration extends AbstractFiberHandler implements ConfigurationInterface { - public function __construct( - private ConfigurationInterface $configuration, - ?LoggerInterface $logger = null - ) { - parent::__construct($logger); + public function __construct(private readonly ConfigurationInterface $configuration, ?LoggerInterface $logger = null) + { } /** diff --git a/src/Transport/Configuration/LazyConfiguration.php b/src/Transport/Configuration/LazyConfiguration.php index e3d38743..71cbb1db 100644 --- a/src/Transport/Configuration/LazyConfiguration.php +++ b/src/Transport/Configuration/LazyConfiguration.php @@ -15,7 +15,7 @@ final class LazyConfiguration implements ConfigurationInterface, LazyInterface private ConfigurationInterface $configuration; private bool $initialized = false; - public function __construct(private ConfigurationInterface $sourceConfiguration) + public function __construct(private readonly ConfigurationInterface $sourceConfiguration) { } diff --git a/src/Transport/Configuration/LongTailConfigurationFactory.php b/src/Transport/Configuration/LongTailConfigurationFactory.php index ea261fd1..524abad6 100644 --- a/src/Transport/Configuration/LongTailConfigurationFactory.php +++ b/src/Transport/Configuration/LongTailConfigurationFactory.php @@ -15,7 +15,7 @@ final class LongTailConfigurationFactory extends AbstractCompoundConfigurationFa /** * @param ConfigurationFactoryInterface[] $factories */ - public function __construct(private iterable $factories) + public function __construct(private readonly iterable $factories) { } diff --git a/src/Transport/Dsn.php b/src/Transport/Dsn.php index a7cd7fef..51c5012d 100644 --- a/src/Transport/Dsn.php +++ b/src/Transport/Dsn.php @@ -23,13 +23,13 @@ final class Dsn * @param array $options */ public function __construct( - private string $scheme, - private string $host, - private ?string $path = null, - private ?string $user = null, - private ?string $password = null, - private ?int $port = null, - private array $options = [], + private readonly string $scheme, + private readonly string $host, + private readonly ?string $path = null, + private readonly ?string $user = null, + private readonly ?string $password = null, + private readonly ?int $port = null, + private readonly array $options = [], private ?string $root = null ) { } diff --git a/src/Transport/FailOverTransport.php b/src/Transport/FailOverTransport.php index be7ee201..3db7e5a6 100644 --- a/src/Transport/FailOverTransport.php +++ b/src/Transport/FailOverTransport.php @@ -18,7 +18,7 @@ final class FailOverTransport extends AbstractCompoundTransport /** * @var SplObjectStorage */ - private SplObjectStorage $failedTransports; + private readonly SplObjectStorage $failedTransports; public function __construct( TransportRegistryInterface $registry, diff --git a/src/Transport/LazyTransport.php b/src/Transport/LazyTransport.php index 11031659..49e73396 100644 --- a/src/Transport/LazyTransport.php +++ b/src/Transport/LazyTransport.php @@ -19,7 +19,7 @@ final class LazyTransport implements TransportInterface, LazyInterface private TransportInterface $transport; private bool $initialized = false; - public function __construct(private TransportInterface $sourceTransport) + public function __construct(private readonly TransportInterface $sourceTransport) { } diff --git a/src/Transport/LongTailTransportFactory.php b/src/Transport/LongTailTransportFactory.php index 64cd683f..389c6320 100644 --- a/src/Transport/LongTailTransportFactory.php +++ b/src/Transport/LongTailTransportFactory.php @@ -17,7 +17,7 @@ final class LongTailTransportFactory extends AbstractCompoundTransportFactory /** * @param iterable|TransportFactoryInterface[] $transportFactories */ - public function __construct(private iterable $transportFactories) + public function __construct(private readonly iterable $transportFactories) { } diff --git a/src/Transport/RoundRobinTransport.php b/src/Transport/RoundRobinTransport.php index 1fd935b2..1c8344c1 100644 --- a/src/Transport/RoundRobinTransport.php +++ b/src/Transport/RoundRobinTransport.php @@ -19,7 +19,7 @@ final class RoundRobinTransport extends AbstractCompoundTransport /** * @var SplObjectStorage */ - private SplObjectStorage $sleepingTransports; + private readonly SplObjectStorage $sleepingTransports; public function __construct( TransportRegistryInterface $registry, diff --git a/src/Transport/TransportFactory.php b/src/Transport/TransportFactory.php index dbd5fedd..14e38503 100644 --- a/src/Transport/TransportFactory.php +++ b/src/Transport/TransportFactory.php @@ -18,7 +18,7 @@ final class TransportFactory /** * @param TransportFactoryInterface[] $factories */ - public function __construct(private iterable $factories) + public function __construct(private readonly iterable $factories) { } diff --git a/src/Worker/ExecutionPolicy/ExecutionPolicyRegistry.php b/src/Worker/ExecutionPolicy/ExecutionPolicyRegistry.php index 437f4857..69841791 100644 --- a/src/Worker/ExecutionPolicy/ExecutionPolicyRegistry.php +++ b/src/Worker/ExecutionPolicy/ExecutionPolicyRegistry.php @@ -20,7 +20,7 @@ final class ExecutionPolicyRegistry implements ExecutionPolicyRegistryInterface /** * @var ExecutionPolicyInterface[] */ - private array $policies; + private readonly array $policies; /** * @param ExecutionPolicyInterface[] $policies diff --git a/src/Worker/WorkerRegistry.php b/src/Worker/WorkerRegistry.php index 4f1c3c17..0265fe39 100644 --- a/src/Worker/WorkerRegistry.php +++ b/src/Worker/WorkerRegistry.php @@ -16,7 +16,7 @@ final class WorkerRegistry implements WorkerRegistryInterface /** * @var WorkerInterface[] */ - private array $workers; + private readonly array $workers; /** * @param WorkerInterface[] $workers