Skip to content

Commit

Permalink
update codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBadura committed Dec 12, 2023
1 parent 3f7344b commit d399fff
Show file tree
Hide file tree
Showing 300 changed files with 1,043 additions and 1,746 deletions.
6 changes: 2 additions & 4 deletions src/Aggregate/AggregateRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

abstract class AggregateRoot
{
private static ?AggregateRootMetadataFactory $metadataFactory = null;
private static AggregateRootMetadataFactory|null $metadataFactory = null;

/** @var list<object> */
private array $uncommittedEvents = [];
Expand Down Expand Up @@ -63,9 +63,7 @@ final public function catchUp(array $events): void
}
}

/**
* @return list<object>
*/
/** @return list<object> */
final public function releaseEvents(): array
{
$events = $this->uncommittedEvents;
Expand Down
4 changes: 2 additions & 2 deletions src/Aggregate/ApplyMethodNotFound.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public function __construct(string $aggregate, string $event)
sprintf(
'Apply method in "%s" could not be found for the event "%s"',
$aggregate,
$event
)
$event,
),
);
}
}
5 changes: 1 addition & 4 deletions src/Attribute/Aggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
#[Attribute(Attribute::TARGET_CLASS)]
final class Aggregate
{
private string $name;

public function __construct(string $name)
public function __construct(private string $name)
{
$this->name = $name;
}

public function name(): string
Expand Down
16 changes: 4 additions & 12 deletions src/Attribute/Apply.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,13 @@
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
final class Apply
{
/** @var class-string|null */
private ?string $eventClass;

/**
* @param class-string|null $eventClass
*/
public function __construct(?string $eventClass = null)
/** @param class-string|null $eventClass */
public function __construct(private string|null $eventClass = null)
{
$this->eventClass = $eventClass;
}

/**
* @return class-string|null
*/
public function eventClass(): ?string
/** @return class-string|null */
public function eventClass(): string|null
{
return $this->eventClass;
}
Expand Down
5 changes: 1 addition & 4 deletions src/Attribute/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
#[Attribute(Attribute::TARGET_CLASS)]
final class Event
{
private string $name;

public function __construct(string $name)
public function __construct(private string $name)
{
$this->name = $name;
}

public function name(): string
Expand Down
14 changes: 3 additions & 11 deletions src/Attribute/Handle.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,12 @@
#[Attribute(Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
final class Handle
{
/** @var class-string */
private string $eventClass;

/**
* @param class-string $eventClass
*/
public function __construct(string $eventClass)
/** @param class-string $eventClass */
public function __construct(private string $eventClass)
{
$this->eventClass = $eventClass;
}

/**
* @return class-string
*/
/** @return class-string */
public function eventClass(): string
{
return $this->eventClass;
Expand Down
5 changes: 1 addition & 4 deletions src/Attribute/NormalizedName.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
#[Attribute(Attribute::TARGET_PROPERTY)]
final class NormalizedName
{
private string $name;

public function __construct(string $name)
public function __construct(private string $name)
{
$this->name = $name;
}

public function name(): string
Expand Down
13 changes: 3 additions & 10 deletions src/Attribute/Snapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,21 @@
#[Attribute(Attribute::TARGET_CLASS)]
final class Snapshot
{
private string $name;
private ?int $batch;
private ?string $version;

public function __construct(string $name, ?int $batch = null, ?string $version = null)
public function __construct(private string $name, private int|null $batch = null, private string|null $version = null)
{
$this->name = $name;
$this->batch = $batch;
$this->version = $version;
}

public function name(): string
{
return $this->name;
}

public function batch(): ?int
public function batch(): int|null
{
return $this->batch;
}

public function version(): ?string
public function version(): string|null
{
return $this->version;
}
Expand Down
8 changes: 2 additions & 6 deletions src/Attribute/SuppressMissingApply.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ final class SuppressMissingApply
private array $suppressEvents = [];
private bool $suppressAll = false;

/**
* @param list<class-string>|self::ALL $suppress
*/
/** @param list<class-string>|self::ALL $suppress */
public function __construct(string|array $suppress)
{
if ($suppress === self::ALL) {
Expand All @@ -29,9 +27,7 @@ public function __construct(string|array $suppress)
$this->suppressEvents = $suppress;
}

/**
* @return list<class-string>
*/
/** @return list<class-string> */
public function suppressEvents(): array
{
return $this->suppressEvents;
Expand Down
4 changes: 1 addition & 3 deletions src/Clock/FrozenClock.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ public function update(DateTimeImmutable $frozenDateTime): void
$this->frozenDateTime = $frozenDateTime;
}

/**
* @param positive-int $seconds
*/
/** @param positive-int $seconds */
public function sleep(int $seconds): void
{
$this->frozenDateTime = $this->frozenDateTime->modify(sprintf('+%s seconds', $seconds));
Expand Down
10 changes: 2 additions & 8 deletions src/Console/Command/DatabaseCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,13 @@

#[AsCommand(
'event-sourcing:database:create',
'create eventstore database'
'create eventstore database',
)]
final class DatabaseCreateCommand extends Command
{
private Store $store;
private DoctrineHelper $helper;

public function __construct(Store $store, DoctrineHelper $helper)
public function __construct(private Store $store, private DoctrineHelper $helper)
{
parent::__construct();

$this->store = $store;
$this->helper = $helper;
}

protected function configure(): void
Expand Down
10 changes: 2 additions & 8 deletions src/Console/Command/DatabaseDropCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,13 @@

#[AsCommand(
'event-sourcing:database:drop',
'drop eventstore database'
'drop eventstore database',
)]
final class DatabaseDropCommand extends Command
{
private Store $store;
private DoctrineHelper $helper;

public function __construct(Store $store, DoctrineHelper $helper)
public function __construct(private Store $store, private DoctrineHelper $helper)
{
parent::__construct();

$this->store = $store;
$this->helper = $helper;
}

protected function configure(): void
Expand Down
8 changes: 4 additions & 4 deletions src/Console/Command/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
#[AsCommand(
'event-sourcing:debug',
'show event sourcing debug information',
['debug:event-sourcing']
['debug:event-sourcing'],
)]
final class DebugCommand extends Command
{
public function __construct(
private readonly AggregateRootRegistry $aggregateRootRegistry,
private readonly EventRegistry $eventRegistry
private readonly EventRegistry $eventRegistry,
) {
parent::__construct();
}
Expand All @@ -48,7 +48,7 @@ private function showAggregates(OutputStyle $console): void

$console->table(
['name', 'class'],
array_map(null, array_keys($aggregates), array_values($aggregates))
array_map(null, array_keys($aggregates), array_values($aggregates)),
);
}

Expand All @@ -60,7 +60,7 @@ private function showEvents(OutputStyle $console): void

$console->table(
['name', 'class'],
array_map(null, array_keys($events), array_values($events))
array_map(null, array_keys($events), array_values($events)),
);
}
}
18 changes: 9 additions & 9 deletions src/Console/Command/OutboxConsumeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

#[AsCommand(
'event-sourcing:outbox:consume',
'published the messages from the outbox store'
'published the messages from the outbox store',
)]
final class OutboxConsumeCommand extends Command
{
public function __construct(
private readonly OutboxConsumer $consumer
private readonly OutboxConsumer $consumer,
) {
parent::__construct();
}
Expand All @@ -40,40 +40,40 @@ protected function configure(): void
'limit',
null,
InputOption::VALUE_REQUIRED,
'How many messages should be consumed in one run (deprecated: use "message-limit" option)'
'How many messages should be consumed in one run (deprecated: use "message-limit" option)',
)
->addOption(
'message-limit',
null,
InputOption::VALUE_REQUIRED,
'How many messages should be consumed in one run',
100
100,
)
->addOption(
'run-limit',
null,
InputOption::VALUE_OPTIONAL,
'The maximum number of runs this command should execute',
1
1,
)
->addOption(
'memory-limit',
null,
InputOption::VALUE_REQUIRED,
'How much memory consumption should the worker be terminated'
'How much memory consumption should the worker be terminated',
)
->addOption(
'time-limit',
null,
InputOption::VALUE_REQUIRED,
'What is the maximum time the worker can run in seconds'
'What is the maximum time the worker can run in seconds',
)
->addOption(
'sleep',
null,
InputOption::VALUE_REQUIRED,
'How much time should elapse before the next job is executed in microseconds',
1000
1000,
);
}

Expand Down Expand Up @@ -121,7 +121,7 @@ function () use ($messageLimit): void {
$this->consumer->consume($messageLimit);
},
$eventDispatcher,
$logger
$logger,
);

if ($sleep < 0) {
Expand Down
10 changes: 2 additions & 8 deletions src/Console/Command/OutboxInfoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,13 @@

#[AsCommand(
'event-sourcing:outbox:info',
'displays the messages stored in the outbox store'
'displays the messages stored in the outbox store',
)]
final class OutboxInfoCommand extends Command
{
private OutboxStore $store;
private EventSerializer $serializer;

public function __construct(OutboxStore $store, EventSerializer $serializer)
public function __construct(private OutboxStore $store, private EventSerializer $serializer)
{
parent::__construct();

$this->store = $store;
$this->serializer = $serializer;
}

protected function configure(): void
Expand Down
Loading

0 comments on commit d399fff

Please sign in to comment.