diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3247fc22..38d37b3f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - php: [8.2, 8.1, 8.0] + php: [8.4, 8.2, 8.1, 8.0] laravel: ['9.*', '10.*', '11.*'] dependency-version: [prefer-lowest, prefer-stable] include: diff --git a/src/AggregateRoots/AggregateRoot.php b/src/AggregateRoots/AggregateRoot.php index e13e8ff6..0de9bcb8 100644 --- a/src/AggregateRoots/AggregateRoot.php +++ b/src/AggregateRoots/AggregateRoot.php @@ -311,7 +311,7 @@ protected function resolvePartials(): Collection return $this->entities; } - public static function fake(string $uuid = null): FakeAggregateRoot + public static function fake(?string $uuid = null): FakeAggregateRoot { $uuid ??= (string) Str::uuid(); diff --git a/src/Projectionist.php b/src/Projectionist.php index 4f67179b..030cc019 100644 --- a/src/Projectionist.php +++ b/src/Projectionist.php @@ -70,7 +70,7 @@ public function allEventHandlers(): EventHandlerCollection return $this->projectors->merge($this->reactors); } - public function withoutEventHandlers(array $eventHandlers = null): Projectionist + public function withoutEventHandlers(?array $eventHandlers = null): Projectionist { if (is_null($eventHandlers)) { $this->projectors = new EventHandlerCollection(); diff --git a/src/StoredEvents/Repositories/EloquentStoredEventRepository.php b/src/StoredEvents/Repositories/EloquentStoredEventRepository.php index f81046c1..77e3928c 100644 --- a/src/StoredEvents/Repositories/EloquentStoredEventRepository.php +++ b/src/StoredEvents/Repositories/EloquentStoredEventRepository.php @@ -38,7 +38,7 @@ public function find(int $id): StoredEvent return $eloquentStoredEvent->toStoredEvent(); } - public function retrieveAll(string $uuid = null): LazyCollection + public function retrieveAll(?string $uuid = null): LazyCollection { $query = $this->getQuery(); @@ -49,7 +49,7 @@ public function retrieveAll(string $uuid = null): LazyCollection return $query->orderBy('id')->cursor()->map(fn (EloquentStoredEvent $storedEvent) => $storedEvent->toStoredEvent()); } - public function retrieveAllStartingFrom(int $startingFrom, string $uuid = null): LazyCollection + public function retrieveAllStartingFrom(int $startingFrom, ?string $uuid = null): LazyCollection { $query = $this->prepareEventModelQuery($startingFrom, $uuid); @@ -61,7 +61,7 @@ public function retrieveAllStartingFrom(int $startingFrom, string $uuid = null): return $lazyCollection->map(fn (EloquentStoredEvent $storedEvent) => $storedEvent->toStoredEvent()); } - public function countAllStartingFrom(int $startingFrom, string $uuid = null): int + public function countAllStartingFrom(int $startingFrom, ?string $uuid = null): int { return $this->prepareEventModelQuery($startingFrom, $uuid)->count('id'); } @@ -78,7 +78,7 @@ public function retrieveAllAfterVersion(int $aggregateVersion, string $aggregate ->map(fn (EloquentStoredEvent $storedEvent) => $storedEvent->toStoredEvent()); } - public function persist(ShouldBeStored $event, string $uuid = null): StoredEvent + public function persist(ShouldBeStored $event, ?string $uuid = null): StoredEvent { /** @var EloquentStoredEvent $eloquentStoredEvent */ $eloquentStoredEvent = new $this->storedEventModel(); @@ -121,7 +121,7 @@ public function persist(ShouldBeStored $event, string $uuid = null): StoredEvent return $eloquentStoredEvent->toStoredEvent(); } - public function persistMany(array $events, string $uuid = null): LazyCollection + public function persistMany(array $events, ?string $uuid = null): LazyCollection { $storedEvents = []; @@ -166,7 +166,7 @@ public function getLatestAggregateVersion(string $aggregateUuid): int ->max('aggregate_version') ?? 0; } - private function prepareEventModelQuery(int $startingFrom, string $uuid = null): Builder + private function prepareEventModelQuery(int $startingFrom, ?string $uuid = null): Builder { $query = $this->getQuery()->startingFrom($startingFrom); diff --git a/src/StoredEvents/Repositories/StoredEventRepository.php b/src/StoredEvents/Repositories/StoredEventRepository.php index ce1657a3..6447a0f2 100644 --- a/src/StoredEvents/Repositories/StoredEventRepository.php +++ b/src/StoredEvents/Repositories/StoredEventRepository.php @@ -10,17 +10,17 @@ interface StoredEventRepository { public function find(int $id): StoredEvent; - public function retrieveAll(string $uuid = null): LazyCollection; + public function retrieveAll(?string $uuid = null): LazyCollection; - public function retrieveAllStartingFrom(int $startingFrom, string $uuid = null): LazyCollection; + public function retrieveAllStartingFrom(int $startingFrom, ?string $uuid = null): LazyCollection; public function retrieveAllAfterVersion(int $aggregateVersion, string $aggregateUuid): LazyCollection; - public function countAllStartingFrom(int $startingFrom, string $uuid = null): int; + public function countAllStartingFrom(int $startingFrom, ?string $uuid = null): int; - public function persist(ShouldBeStored $event, string $uuid = null): StoredEvent; + public function persist(ShouldBeStored $event, ?string $uuid = null): StoredEvent; - public function persistMany(array $events, string $uuid = null): LazyCollection; + public function persistMany(array $events, ?string $uuid = null): LazyCollection; public function update(StoredEvent $storedEvent): StoredEvent; diff --git a/src/Support/CarbonNormalizer.php b/src/Support/CarbonNormalizer.php index b8c7477f..81462599 100644 --- a/src/Support/CarbonNormalizer.php +++ b/src/Support/CarbonNormalizer.php @@ -13,7 +13,7 @@ class CarbonNormalizer implements NormalizerInterface, DenormalizerInterface /** * @inheritdoc */ - public function normalize(mixed $object, string $format = null, array $context = []): string + public function normalize(mixed $object, ?string $format = null, array $context = []): string { if (! $object instanceof CarbonInterface) { throw new InvalidArgumentException('Cannot serialize an object that is not a CarbonInterface in CarbonNormalizer.'); @@ -25,7 +25,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * @inheritdoc */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return $data instanceof CarbonInterface; } @@ -33,7 +33,7 @@ public function supportsNormalization(mixed $data, string $format = null, array /** * @inheritDoc */ - public function denormalize(mixed $data, string $class, string $format = null, array $context = []): CarbonInterface + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): CarbonInterface { return Date::parse($data); } @@ -41,7 +41,7 @@ public function denormalize(mixed $data, string $class, string $format = null, a /** * @inheritDoc */ - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { return is_a($type, CarbonInterface::class, true); } diff --git a/src/Support/ModelIdentifierNormalizer.php b/src/Support/ModelIdentifierNormalizer.php index 08bfbe2f..55398ff1 100644 --- a/src/Support/ModelIdentifierNormalizer.php +++ b/src/Support/ModelIdentifierNormalizer.php @@ -19,7 +19,7 @@ class ModelIdentifierNormalizer implements NormalizerInterface, DenormalizerInte /** * @inheritdoc */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { if (! $this->supportsNormalization($object)) { throw new InvalidArgumentException('Cannot serialize an object that is not a QueueableEntity or QueueableCollection in ModelIdentifierNormalizer.'); @@ -31,7 +31,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * @inheritdoc */ - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { return ($data instanceof QueueableEntity || $data instanceof QueueableCollection); } @@ -39,7 +39,7 @@ public function supportsNormalization(mixed $data, string $format = null, array /** * @inheritdoc */ - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): Collection|Model + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): Collection|Model { $identifier = $data instanceof ModelIdentifier ? $data @@ -51,7 +51,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar /** * @inheritdoc */ - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { return $this->normalizedDataIsModelIdentifier($data) && $this->isNormalizedToModelIdentifier($type);