Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -54,6 +54,7 @@
SetList::PHP_73,
SetList::PHP_74,
SetList::PHP_80,
SetList::PHP_81,
SetList::UNWRAP_COMPAT,
]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
abstract class AbstractDoctrineConnection
{
public function __construct(private DBALConnection $driverConnection)
public function __construct(private readonly DBALConnection $driverConnection)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
final class DoctrineConfigurationFactory implements ConfigurationFactoryInterface
{
public function __construct(private ConnectionRegistry $registry)
public function __construct(private readonly ConnectionRegistry $registry)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/Transport/DoctrineTransportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
final class DoctrineTransportFactory implements TransportFactoryInterface
{
public function __construct(private ConnectionRegistry $registry)
public function __construct(private readonly ConnectionRegistry $registry)
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/Bridge/Redis/Transport/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
8 changes: 4 additions & 4 deletions src/Command/ConsumeTasksCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/Command/DebugConfigurationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
)]
final class DebugConfigurationCommand extends Command
{
public function __construct(private ConfigurationInterface $configuration)
public function __construct(private readonly ConfigurationInterface $configuration)
{
parent::__construct();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Command/DebugMiddlewareCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Command/DebugProbeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Command/ExecuteExternalProbeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
12 changes: 4 additions & 8 deletions src/Command/ExecuteTaskCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Command/ListFailedTasksCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
)]
final class ListFailedTasksCommand extends Command
{
public function __construct(private WorkerInterface $worker)
public function __construct(private readonly WorkerInterface $worker)
{
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ListTasksCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
12 changes: 4 additions & 8 deletions src/Command/RebootSchedulerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
4 changes: 2 additions & 2 deletions src/Command/RemoveFailedTaskCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
6 changes: 3 additions & 3 deletions src/Command/RetryFailedTaskCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/Command/YieldTaskCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
)]
final class YieldTaskCommand extends Command
{
public function __construct(private SchedulerInterface $scheduler)
public function __construct(private readonly SchedulerInterface $scheduler)
{
parent::__construct();
}
Expand Down
4 changes: 2 additions & 2 deletions src/DataCollector/SchedulerDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/SchedulerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/SchedulerRebootedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
final class SchedulerRebootedEvent extends Event
{
public function __construct(private SchedulerInterface $scheduler)
public function __construct(private readonly SchedulerInterface $scheduler)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/TaskExecutedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/TaskExecutingEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/TaskFailedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
final class TaskFailedEvent extends Event implements TaskEventInterface
{
public function __construct(private FailedTask $task)
public function __construct(private readonly FailedTask $task)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/TaskScheduledEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
final class TaskScheduledEvent extends Event implements TaskEventInterface
{
public function __construct(private TaskInterface $task)
public function __construct(private readonly TaskInterface $task)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/TaskUnscheduledEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
final class TaskUnscheduledEvent extends Event implements TaskEventInterface
{
public function __construct(private string $task)
public function __construct(private readonly string $task)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/WorkerForkedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/WorkerPausedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
final class WorkerPausedEvent extends Event
{
public function __construct(private WorkerInterface $worker)
public function __construct(private readonly WorkerInterface $worker)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/WorkerRestartedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
final class WorkerRestartedEvent extends Event
{
public function __construct(private WorkerInterface $worker)
public function __construct(private readonly WorkerInterface $worker)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/WorkerRunningEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/WorkerSleepingEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/WorkerStartedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
final class WorkerStartedEvent extends Event implements WorkerEventInterface
{
public function __construct(private WorkerInterface $worker)
public function __construct(private readonly WorkerInterface $worker)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/WorkerStoppedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
final class WorkerStoppedEvent extends Event
{
public function __construct(private WorkerInterface $worker)
public function __construct(private readonly WorkerInterface $worker)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/ProbeStateSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
{
}

Expand Down
7 changes: 2 additions & 5 deletions src/EventListener/StopWorkerOnFailureLimitSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
5 changes: 1 addition & 4 deletions src/EventListener/StopWorkerOnSignalSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading