Skip to content

Commit

Permalink
rector PHP 8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaukutsu committed Feb 24, 2024
1 parent 731dd76 commit 4aa3008
Show file tree
Hide file tree
Showing 48 changed files with 198 additions and 198 deletions.
6 changes: 3 additions & 3 deletions src/EntityWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
use Serializable;
use kuaukutsu\poc\task\exception\UnsupportedException;

final class EntityWrapper implements Serializable
final readonly class EntityWrapper implements Serializable
{
/**
* @param class-string<EntityHandler> $class
* @param array<string, string|int|bool|string[]|int[]|array|object|null> $params Конфигурация объекта.
*/
public function __construct(
public readonly string $class,
public readonly array $params = [],
public string $class,
public array $params = [],
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/TaskBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
use kuaukutsu\poc\task\exception\BuilderException;
use kuaukutsu\poc\task\service\TaskCreator;

final class TaskBuilder
final readonly class TaskBuilder
{
public function __construct(private readonly TaskCreator $creator)
public function __construct(private TaskCreator $creator)
{
}

Expand Down
16 changes: 8 additions & 8 deletions src/TaskManagerOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace kuaukutsu\poc\task;

final class TaskManagerOptions
final readonly class TaskManagerOptions
{
/**
* @param float $heartbeat in Seconds
Expand All @@ -13,13 +13,13 @@ final class TaskManagerOptions
* @param int[] $interruptSignals A POSIX signal
*/
public function __construct(
private readonly ?string $bindir = null,
private readonly float $heartbeat = 30.,
private readonly float $keeperInterval = 5.,
private readonly int $queueSize = 10,
public readonly ?float $timeout = null,
public readonly string $handler = 'handler.php',
public readonly array $interruptSignals = [SIGHUP, SIGINT, SIGTERM],
private ?string $bindir = null,
private float $heartbeat = 30.,
private float $keeperInterval = 5.,
private int $queueSize = 10,
public ?float $timeout = null,
public string $handler = 'handler.php',
public array $interruptSignals = [SIGHUP, SIGINT, SIGTERM],
) {
}

Expand Down
8 changes: 4 additions & 4 deletions src/TaskStageContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

use kuaukutsu\poc\task\state\TaskStateInterface;

final class TaskStageContext
final readonly class TaskStageContext
{
/**
* @param non-empty-string $task
* @param non-empty-string $stage
*/
public function __construct(
public readonly string $task,
public readonly string $stage,
public readonly ?TaskStateInterface $previous = null,
public string $task,
public string $stage,
public ?TaskStateInterface $previous = null,
) {
}
}
18 changes: 9 additions & 9 deletions src/dto/StageModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* @readonly
*/
final class StageModel implements EntityArrable
final readonly class StageModel implements EntityArrable
{
/**
* @param non-empty-string $uuid
Expand All @@ -19,14 +19,14 @@ final class StageModel implements EntityArrable
* @param non-empty-string $updatedAt
*/
public function __construct(
public readonly string $uuid,
public readonly string $taskUuid,
public readonly int $flag,
public readonly string $state,
public readonly string $handler,
public readonly int $order,
public readonly string $createdAt,
public readonly string $updatedAt,
public string $uuid,
public string $taskUuid,
public int $flag,
public string $state,
public string $handler,
public int $order,
public string $createdAt,
public string $updatedAt,
) {
}

Expand Down
12 changes: 6 additions & 6 deletions src/dto/StageModelCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
/**
* @readonly
*/
final class StageModelCreate implements EntityArrable
final readonly class StageModelCreate implements EntityArrable
{
public function __construct(
public readonly string $taskUuid,
public readonly int $flag,
public readonly string $state,
public readonly string $handler,
public readonly int $order,
public string $taskUuid,
public int $flag,
public string $state,
public string $handler,
public int $order,
) {
}

Expand Down
14 changes: 7 additions & 7 deletions src/dto/TaskMetrics.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

use kuaukutsu\poc\task\EntityArrable;

final class TaskMetrics implements EntityArrable
final readonly class TaskMetrics implements EntityArrable
{
public function __construct(
public readonly int $count = 0,
public readonly int $running = 0,
public readonly int $waiting = 0,
public readonly int $success = 0,
public readonly int $canceled = 0,
public readonly int $failed = 0,
public int $count = 0,
public int $running = 0,
public int $waiting = 0,
public int $success = 0,
public int $canceled = 0,
public int $failed = 0,
) {
}

Expand Down
18 changes: 9 additions & 9 deletions src/dto/TaskModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/**
* @readonly
*/
final class TaskModel implements EntityArrable
final readonly class TaskModel implements EntityArrable
{
/**
* @param non-empty-string $uuid
Expand All @@ -20,14 +20,14 @@ final class TaskModel implements EntityArrable
* @param non-empty-string $updatedAt
*/
public function __construct(
public readonly string $uuid,
public readonly string $title,
public readonly int $flag,
public readonly string $state,
public readonly array $options,
public readonly string $checksum,
public readonly string $createdAt,
public readonly string $updatedAt,
public string $uuid,
public string $title,
public int $flag,
public string $state,
public array $options,
public string $checksum,
public string $createdAt,
public string $updatedAt,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/dto/TaskOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
/**
* @readonly
*/
final class TaskOptions implements EntityArrable
final readonly class TaskOptions implements EntityArrable
{
/**
* @param float $timeout В секундах.
* @param class-string<EntityFinally>|null $finally
*/
public function __construct(
public readonly float $timeout,
public readonly ?string $finally = null,
public float $timeout,
public ?string $finally = null,
) {
}

Expand Down
18 changes: 9 additions & 9 deletions src/dto/TaskView.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
/**
* @readonly
*/
final class TaskView implements EntityArrable
final readonly class TaskView implements EntityArrable
{
public function __construct(
public readonly string $uuid,
public readonly string $title,
public readonly string $state,
public readonly string $message,
public readonly TaskMetrics $metrics,
public readonly ?TaskView $relation,
public readonly string $createdAt,
public readonly string $updatedAt,
public string $uuid,
public string $title,
public string $state,
public string $message,
public TaskMetrics $metrics,
public ?TaskView $relation,
public string $createdAt,
public string $updatedAt,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/event/ProcessTimeoutEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
use kuaukutsu\poc\task\processing\TaskProcess;
use Symfony\Component\Process\Process;

final class ProcessTimeoutEvent implements EventInterface
final readonly class ProcessTimeoutEvent implements EventInterface
{
public function __construct(
private readonly TaskProcess $process,
private readonly string $message,
private TaskProcess $process,
private string $message,
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/handler/StageExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
use kuaukutsu\poc\task\state\TaskStateMessage;
use kuaukutsu\poc\task\TaskStageContext;

final class StageExecutor
final readonly class StageExecutor
{
public function __construct(private readonly StageHandlerFactory $handlerFactory)
public function __construct(private StageHandlerFactory $handlerFactory)
{
}

Expand Down
6 changes: 3 additions & 3 deletions src/handler/StageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
use kuaukutsu\poc\task\state\TaskStateSuccess;
use kuaukutsu\poc\task\state\TaskCommand;

final class StageHandler
final readonly class StageHandler
{
public function __construct(
private readonly TaskHandler $handler,
private readonly ConsoleOutputInterface $output,
private TaskHandler $handler,
private ConsoleOutputInterface $output,
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/handler/StageHandlerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
use kuaukutsu\poc\task\EntityWrapper;
use kuaukutsu\poc\task\exception\BuilderException;

final class StageHandlerFactory
final readonly class StageHandlerFactory
{
public function __construct(private readonly FactoryInterface $container)
public function __construct(private FactoryInterface $container)
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/handler/TaskFinallyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
use kuaukutsu\poc\task\state\TaskStatePrepare;
use kuaukutsu\poc\task\EntityFinally;

final class TaskFinallyHandler
final readonly class TaskFinallyHandler
{
use TaskStatePrepare;

public function __construct(private readonly ContainerInterface $container)
public function __construct(private ContainerInterface $container)
{
}

Expand Down
18 changes: 9 additions & 9 deletions src/processing/TaskHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@
use kuaukutsu\poc\task\EntityTask;
use kuaukutsu\poc\task\EntityUuid;

final class TaskHandler
final readonly class TaskHandler
{
public function __construct(
private readonly TaskQuery $taskQuery,
private readonly TaskFactory $taskFactory,
private readonly TaskExecutor $taskExecutor,
private readonly TaskFinallyHandler $finallyHandler,
private readonly StageQuery $stageQuery,
private readonly StageCommand $stageCommand,
private readonly StageContextFactory $contextFactory,
private readonly StageExecutor $executor,
private TaskQuery $taskQuery,
private TaskFactory $taskFactory,
private TaskExecutor $taskExecutor,
private TaskFinallyHandler $finallyHandler,
private StageQuery $stageQuery,
private StageCommand $stageCommand,
private StageContextFactory $contextFactory,
private StageExecutor $executor,
) {
}

Expand Down
10 changes: 5 additions & 5 deletions src/processing/TaskProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* Process Decorator.
*/
final class TaskProcess
final readonly class TaskProcess
{
/**
* @see https://tldp.org/LDP/abs/html/exitcodes.html
Expand All @@ -25,10 +25,10 @@ final class TaskProcess
* @param non-empty-string $stage
*/
public function __construct(
public readonly string $hash,
public readonly string $task,
public readonly string $stage,
private readonly Process $process,
public string $hash,
public string $task,
public string $stage,
private Process $process,
) {
}

Expand Down
14 changes: 7 additions & 7 deletions src/processing/TaskProcessContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

use kuaukutsu\poc\task\dto\TaskOptions;

final class TaskProcessContext
final readonly class TaskProcessContext
{
/**
* @var non-empty-string
*/
private readonly string $hash;
private string $hash;

/**
* @param non-empty-string $task Task UUID
Expand All @@ -20,11 +20,11 @@ final class TaskProcessContext
* @param positive-int|null $timestamp Примерное время (Unix) не раньше которого задача должна быть выполнена.
*/
public function __construct(
public readonly string $task,
public readonly string $stage,
public readonly TaskOptions $options,
public readonly ?string $previous = null,
public readonly ?int $timestamp = null,
public string $task,
public string $stage,
public TaskOptions $options,
public ?string $previous = null,
public ?int $timestamp = null,
) {
$this->hash = hash('crc32b', $this->task . $this->stage);
}
Expand Down
Loading

0 comments on commit 4aa3008

Please sign in to comment.