diff --git a/baseline.xml b/baseline.xml index 6ba800a47..09621b43a 100644 --- a/baseline.xml +++ b/baseline.xml @@ -1,5 +1,5 @@ - + new static() @@ -188,6 +188,23 @@ $name + + + 'bar', + 'aggregateClass' => Profile::class, + 'aggregateId' => '1', + 'playhead' => 3, + 'recordedOn' => $recordedAt, + 'newStreamStart' => true, + 'archived' => true, + ]]]> + + + assertSame + assertSame + + $value diff --git a/src/EventBus/Message.php b/src/EventBus/Message.php index 537806fd7..b0e4de0a6 100644 --- a/src/EventBus/Message.php +++ b/src/EventBus/Message.php @@ -12,7 +12,14 @@ /** * @template-covariant T of object * @psalm-immutable - * @psalm-type Headers = array{aggregateClass?: class-string, aggregateId?:string, playhead?:positive-int, recordedOn?: DateTimeImmutable, newStreamStart?: bool, archived?: bool} + * @psalm-type Headers = array{ + * aggregateClass?: class-string, + * aggregateId?: string, + * playhead?: positive-int, + * recordedOn?: DateTimeImmutable, + * newStreamStart?: bool, + * archived?: bool + * } */ final class Message { diff --git a/tests/Unit/Aggregate/UuidTest.php b/tests/Unit/Aggregate/UuidTest.php index c44fc0a64..cbeaa9497 100644 --- a/tests/Unit/Aggregate/UuidTest.php +++ b/tests/Unit/Aggregate/UuidTest.php @@ -4,6 +4,7 @@ namespace Patchlevel\EventSourcing\Tests\Unit\Aggregate; +use DateTimeInterface; use Patchlevel\EventSourcing\Aggregate\Uuid; use PHPUnit\Framework\TestCase; use Ramsey\Uuid\Uuid as RamseyUuid; @@ -40,7 +41,7 @@ public function testV7(): void { $factory = new class extends UuidFactory { - public function uuid7($node = null, int|null $clockSeq = null): UuidInterface + public function uuid7(DateTimeInterface|null $dateTime = null): UuidInterface { return RamseyUuid::fromString('018d6a97-6aba-7104-825f-67313a77a2a4'); } diff --git a/tests/Unit/EventBus/MessageTest.php b/tests/Unit/EventBus/MessageTest.php index eea0075a2..70d135e6b 100644 --- a/tests/Unit/EventBus/MessageTest.php +++ b/tests/Unit/EventBus/MessageTest.php @@ -5,6 +5,7 @@ namespace Patchlevel\EventSourcing\Tests\Unit\EventBus; use DateTimeImmutable; +use Generator; use Patchlevel\EventSourcing\EventBus\HeaderNotFound; use Patchlevel\EventSourcing\EventBus\Message; use Patchlevel\EventSourcing\Tests\Unit\Fixture\Email; @@ -220,7 +221,8 @@ public function testHeaderNotFound(string $headerName): void $message->{$headerName}(); } - public static function provideHeaderNotFound() + /** @return Generator */ + public static function provideHeaderNotFound(): Generator { yield 'aggregateClass' => ['aggregateClass']; yield 'aggregateId' => ['aggregateId']; diff --git a/tests/Unit/Lock/DoctrineDbalStoreSchemaAdapterTest.php b/tests/Unit/Lock/DoctrineDbalStoreSchemaAdapterTest.php index b3be3b7ef..2a820cf02 100644 --- a/tests/Unit/Lock/DoctrineDbalStoreSchemaAdapterTest.php +++ b/tests/Unit/Lock/DoctrineDbalStoreSchemaAdapterTest.php @@ -4,6 +4,7 @@ namespace Patchlevel\EventSourcing\Tests\Unit\Lock; +use Closure; use Doctrine\DBAL\Connection; use Doctrine\DBAL\Schema\Schema; use Patchlevel\EventSourcing\Lock\DoctrineDbalStoreSchemaAdapter; @@ -25,6 +26,7 @@ public function testConfigureSchema(): void //$store->configureSchema($schema, Argument::type('Closure'))->shouldBeCalledOnce(); $store->configureSchema($schema, Argument::any())->shouldBeCalledOnce()->will( + /** @param array{1: Closure} $args */ static function (array $args): void { if (!$args[1]()) { throw new RuntimeException(); diff --git a/tests/Unit/Snapshot/SnapshotNotConfiguredTest.php b/tests/Unit/Snapshot/SnapshotNotConfiguredTest.php index 55001e4df..3a43ae7b4 100644 --- a/tests/Unit/Snapshot/SnapshotNotConfiguredTest.php +++ b/tests/Unit/Snapshot/SnapshotNotConfiguredTest.php @@ -5,6 +5,7 @@ namespace Patchlevel\EventSourcing\Tests\Unit\Snapshot; use Patchlevel\EventSourcing\Snapshot\SnapshotNotConfigured; +use Patchlevel\EventSourcing\Tests\Unit\Fixture\Profile; use PHPUnit\Framework\TestCase; /** @covers \Patchlevel\EventSourcing\Snapshot\SnapshotNotConfigured */ @@ -12,10 +13,10 @@ final class SnapshotNotConfiguredTest extends TestCase { public function testCreate(): void { - $exception = new SnapshotNotConfigured('Foo\Profile'); + $exception = new SnapshotNotConfigured(Profile::class); self::assertSame( - 'Missing snapshot configuration for the aggregate class "Foo\Profile"', + 'Missing snapshot configuration for the aggregate class "Patchlevel\EventSourcing\Tests\Unit\Fixture\Profile"', $exception->getMessage(), ); self::assertSame(0, $exception->getCode()); diff --git a/tests/Unit/Snapshot/SnapshotNotFoundTest.php b/tests/Unit/Snapshot/SnapshotNotFoundTest.php index c95e44bf4..ee387fed7 100644 --- a/tests/Unit/Snapshot/SnapshotNotFoundTest.php +++ b/tests/Unit/Snapshot/SnapshotNotFoundTest.php @@ -7,6 +7,7 @@ use Patchlevel\EventSourcing\Aggregate\AggregateRootId; use Patchlevel\EventSourcing\Aggregate\CustomIdBehaviour; use Patchlevel\EventSourcing\Snapshot\SnapshotNotFound; +use Patchlevel\EventSourcing\Tests\Unit\Fixture\Profile; use PHPUnit\Framework\TestCase; /** @covers \Patchlevel\EventSourcing\Snapshot\SnapshotNotFound */ @@ -14,12 +15,12 @@ final class SnapshotNotFoundTest extends TestCase { public function testCreate(): void { - $exception = new SnapshotNotFound('Foo\Profile', new class ('1') implements AggregateRootId { + $exception = new SnapshotNotFound(Profile::class, new class ('1') implements AggregateRootId { use CustomIdBehaviour; }); self::assertSame( - 'snapshot for aggregate "Foo\Profile" with the id "1" not found', + 'snapshot for aggregate "Patchlevel\EventSourcing\Tests\Unit\Fixture\Profile" with the id "1" not found', $exception->getMessage(), ); self::assertSame(0, $exception->getCode());