Skip to content

Commit 5c1eabe

Browse files
committed
use identifier component
1 parent 23f3438 commit 5c1eabe

7 files changed

Lines changed: 16 additions & 117 deletions

File tree

src/DCB/AttributeEventTagExtractor.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace Patchlevel\EventSourcing\DCB;
66

77
use Patchlevel\EventSourcing\Attribute\EventTag;
8-
use Patchlevel\EventSourcing\Stringable;
8+
use Patchlevel\EventSourcing\Identifier\Identifier;
99
use ReflectionClass;
10-
use Stringable as NativeStringable;
10+
use Stringable;
1111

1212
use function array_keys;
1313
use function hash;
@@ -36,12 +36,12 @@ public function extract(object $event): array
3636

3737
$value = $property->getValue($event);
3838

39-
if ($value instanceof Stringable) {
40-
$value = $value->toString();
39+
if ($value instanceof Stringable || is_int($value)) {
40+
$value = (string)$value;
4141
}
4242

43-
if ($value instanceof NativeStringable || is_int($value)) {
44-
$value = (string)$value;
43+
if ($value instanceof Identifier) {
44+
$value = $value->toString();
4545
}
4646

4747
if (!is_string($value)) {

src/Serializer/Normalizer/StringableNormalizer.php

Lines changed: 0 additions & 85 deletions
This file was deleted.

src/Stringable.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/Benchmark/SimpleSetupTaggableStoreBench.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Patchlevel\EventSourcing\Tests\Benchmark;
66

7-
use Patchlevel\EventSourcing\Aggregate\AggregateRootId;
7+
use Patchlevel\EventSourcing\Identifier\Identifier;
88
use Patchlevel\EventSourcing\Message\Message;
99
use Patchlevel\EventSourcing\Metadata\Event\AttributeEventRegistryFactory;
1010
use Patchlevel\EventSourcing\Repository\DefaultRepository;
@@ -24,8 +24,8 @@ final class SimpleSetupTaggableStoreBench
2424
private TaggableDoctrineDbalStore $store;
2525
private Repository $repository;
2626

27-
private AggregateRootId $singleEventId;
28-
private AggregateRootId $multipleEventsId;
27+
private Identifier $singleEventId;
28+
private Identifier $multipleEventsId;
2929

3030
public function setUp(): void
3131
{

tests/Integration/DynamicConsistencyBoundary/Course/CourseId.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace Patchlevel\EventSourcing\Tests\Integration\DynamicConsistencyBoundary\Course;
66

7-
use Patchlevel\EventSourcing\Aggregate\RamseyUuidV7Behaviour;
8-
use Patchlevel\EventSourcing\Stringable;
7+
use Patchlevel\EventSourcing\Identifier\Identifier;
8+
use Patchlevel\EventSourcing\Identifier\RamseyUuidV7Behaviour;
99

10-
final class CourseId implements Stringable
10+
final class CourseId implements Identifier
1111
{
1212
use RamseyUuidV7Behaviour;
1313
}

tests/Integration/DynamicConsistencyBoundary/Course/StudentId.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace Patchlevel\EventSourcing\Tests\Integration\DynamicConsistencyBoundary\Course;
66

7-
use Patchlevel\EventSourcing\Aggregate\RamseyUuidV7Behaviour;
8-
use Patchlevel\EventSourcing\Stringable;
7+
use Patchlevel\EventSourcing\Identifier\Identifier;
8+
use Patchlevel\EventSourcing\Identifier\RamseyUuidV7Behaviour;
99

10-
final class StudentId implements Stringable
10+
final class StudentId implements Identifier
1111
{
1212
use RamseyUuidV7Behaviour;
1313
}

tests/Unit/DCB/AttributeEventTagExtractorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace Patchlevel\EventSourcing\Tests\Unit\DCB;
66

7-
use Patchlevel\EventSourcing\Aggregate\CustomId;
87
use Patchlevel\EventSourcing\Attribute\EventTag;
98
use Patchlevel\EventSourcing\DCB\AttributeEventTagExtractor;
9+
use Patchlevel\EventSourcing\Identifier\CustomId;
1010
use PHPUnit\Framework\TestCase;
1111

1212
final class AttributeEventTagExtractorTest extends TestCase

0 commit comments

Comments
 (0)