From 1534c2e77c187d1483c074ef76ac472a3a34bf4b Mon Sep 17 00:00:00 2001 From: David Badura Date: Wed, 13 Mar 2024 10:45:16 +0100 Subject: [PATCH 1/2] move trace feature into debug namespace --- .../MessageDecorator => Debug/Trace}/Trace.php | 2 +- .../Trace}/TraceDecorator.php | 3 ++- .../MessageDecorator => Debug/Trace}/TraceHeader.php | 2 +- .../MessageDecorator => Debug/Trace}/TraceStack.php | 2 +- .../Trace}/TraceableSubscriberAccessor.php | 5 ++--- .../Trace}/TraceableSubscriberAccessorRepository.php | 4 ++-- tests/Integration/Subscription/SubscriptionTest.php | 8 ++++---- .../Trace}/TraceDecoratorTest.php | 12 ++++++------ .../Trace}/TraceStackTest.php | 8 ++++---- 9 files changed, 23 insertions(+), 23 deletions(-) rename src/{Repository/MessageDecorator => Debug/Trace}/Trace.php (76%) rename src/{Repository/MessageDecorator => Debug/Trace}/TraceDecorator.php (86%) rename src/{Repository/MessageDecorator => Debug/Trace}/TraceHeader.php (82%) rename src/{Repository/MessageDecorator => Debug/Trace}/TraceStack.php (90%) rename src/{Subscription/Subscriber => Debug/Trace}/TraceableSubscriberAccessor.php (90%) rename src/{Subscription/Subscriber => Debug/Trace}/TraceableSubscriberAccessorRepository.php (90%) rename tests/Unit/{Repository/MessageDecorator => Debug/Trace}/TraceDecoratorTest.php (74%) rename tests/Unit/{Repository/MessageDecorator => Debug/Trace}/TraceStackTest.php (64%) diff --git a/src/Repository/MessageDecorator/Trace.php b/src/Debug/Trace/Trace.php similarity index 76% rename from src/Repository/MessageDecorator/Trace.php rename to src/Debug/Trace/Trace.php index bcc2357b3..b142225f4 100644 --- a/src/Repository/MessageDecorator/Trace.php +++ b/src/Debug/Trace/Trace.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\Repository\MessageDecorator; +namespace Patchlevel\EventSourcing\Debug\Trace; /** @experimental */ final class Trace diff --git a/src/Repository/MessageDecorator/TraceDecorator.php b/src/Debug/Trace/TraceDecorator.php similarity index 86% rename from src/Repository/MessageDecorator/TraceDecorator.php rename to src/Debug/Trace/TraceDecorator.php index 5ca913eba..2b7475d6f 100644 --- a/src/Repository/MessageDecorator/TraceDecorator.php +++ b/src/Debug/Trace/TraceDecorator.php @@ -2,9 +2,10 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\Repository\MessageDecorator; +namespace Patchlevel\EventSourcing\Debug\Trace; use Patchlevel\EventSourcing\EventBus\Message; +use Patchlevel\EventSourcing\Repository\MessageDecorator\MessageDecorator; use function array_map; diff --git a/src/Repository/MessageDecorator/TraceHeader.php b/src/Debug/Trace/TraceHeader.php similarity index 82% rename from src/Repository/MessageDecorator/TraceHeader.php rename to src/Debug/Trace/TraceHeader.php index c7c10d231..2151b420a 100644 --- a/src/Repository/MessageDecorator/TraceHeader.php +++ b/src/Debug/Trace/TraceHeader.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\Repository\MessageDecorator; +namespace Patchlevel\EventSourcing\Debug\Trace; use Patchlevel\EventSourcing\Attribute\Header; diff --git a/src/Repository/MessageDecorator/TraceStack.php b/src/Debug/Trace/TraceStack.php similarity index 90% rename from src/Repository/MessageDecorator/TraceStack.php rename to src/Debug/Trace/TraceStack.php index 24b71b9e3..f1135d68a 100644 --- a/src/Repository/MessageDecorator/TraceStack.php +++ b/src/Debug/Trace/TraceStack.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\Repository\MessageDecorator; +namespace Patchlevel\EventSourcing\Debug\Trace; use function array_values; diff --git a/src/Subscription/Subscriber/TraceableSubscriberAccessor.php b/src/Debug/Trace/TraceableSubscriberAccessor.php similarity index 90% rename from src/Subscription/Subscriber/TraceableSubscriberAccessor.php rename to src/Debug/Trace/TraceableSubscriberAccessor.php index ded474b8b..0942b1d73 100644 --- a/src/Subscription/Subscriber/TraceableSubscriberAccessor.php +++ b/src/Debug/Trace/TraceableSubscriberAccessor.php @@ -2,13 +2,12 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\Subscription\Subscriber; +namespace Patchlevel\EventSourcing\Debug\Trace; use Closure; use Patchlevel\EventSourcing\EventBus\Message; -use Patchlevel\EventSourcing\Repository\MessageDecorator\Trace; -use Patchlevel\EventSourcing\Repository\MessageDecorator\TraceStack; use Patchlevel\EventSourcing\Subscription\RunMode; +use Patchlevel\EventSourcing\Subscription\Subscriber\SubscriberAccessor; use function array_map; diff --git a/src/Subscription/Subscriber/TraceableSubscriberAccessorRepository.php b/src/Debug/Trace/TraceableSubscriberAccessorRepository.php similarity index 90% rename from src/Subscription/Subscriber/TraceableSubscriberAccessorRepository.php rename to src/Debug/Trace/TraceableSubscriberAccessorRepository.php index 344073070..0681f4b90 100644 --- a/src/Subscription/Subscriber/TraceableSubscriberAccessorRepository.php +++ b/src/Debug/Trace/TraceableSubscriberAccessorRepository.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\Subscription\Subscriber; +namespace Patchlevel\EventSourcing\Debug\Trace; -use Patchlevel\EventSourcing\Repository\MessageDecorator\TraceStack; +use Patchlevel\EventSourcing\Subscription\Subscriber\SubscriberAccessorRepository; use function array_values; diff --git a/tests/Integration/Subscription/SubscriptionTest.php b/tests/Integration/Subscription/SubscriptionTest.php index d0083f6d4..61c6b35b6 100644 --- a/tests/Integration/Subscription/SubscriptionTest.php +++ b/tests/Integration/Subscription/SubscriptionTest.php @@ -7,14 +7,15 @@ use DateTimeImmutable; use Doctrine\DBAL\Connection; use Patchlevel\EventSourcing\Clock\FrozenClock; +use Patchlevel\EventSourcing\Debug\Trace\TraceableSubscriberAccessorRepository; +use Patchlevel\EventSourcing\Debug\Trace\TraceDecorator; +use Patchlevel\EventSourcing\Debug\Trace\TraceHeader; +use Patchlevel\EventSourcing\Debug\Trace\TraceStack; use Patchlevel\EventSourcing\EventBus\DefaultEventBus; use Patchlevel\EventSourcing\EventBus\Message; use Patchlevel\EventSourcing\EventBus\Serializer\DefaultHeadersSerializer; use Patchlevel\EventSourcing\Metadata\AggregateRoot\AggregateRootRegistry; use Patchlevel\EventSourcing\Repository\DefaultRepositoryManager; -use Patchlevel\EventSourcing\Repository\MessageDecorator\TraceDecorator; -use Patchlevel\EventSourcing\Repository\MessageDecorator\TraceHeader; -use Patchlevel\EventSourcing\Repository\MessageDecorator\TraceStack; use Patchlevel\EventSourcing\Schema\ChainDoctrineSchemaConfigurator; use Patchlevel\EventSourcing\Schema\DoctrineSchemaDirector; use Patchlevel\EventSourcing\Serializer\DefaultEventSerializer; @@ -26,7 +27,6 @@ use Patchlevel\EventSourcing\Subscription\Status; use Patchlevel\EventSourcing\Subscription\Store\DoctrineSubscriptionStore; use Patchlevel\EventSourcing\Subscription\Subscriber\MetadataSubscriberAccessorRepository; -use Patchlevel\EventSourcing\Subscription\Subscriber\TraceableSubscriberAccessorRepository; use Patchlevel\EventSourcing\Subscription\Subscription; use Patchlevel\EventSourcing\Tests\DbalManager; use Patchlevel\EventSourcing\Tests\Integration\Subscription\Aggregate\Profile; diff --git a/tests/Unit/Repository/MessageDecorator/TraceDecoratorTest.php b/tests/Unit/Debug/Trace/TraceDecoratorTest.php similarity index 74% rename from tests/Unit/Repository/MessageDecorator/TraceDecoratorTest.php rename to tests/Unit/Debug/Trace/TraceDecoratorTest.php index 4434d5868..851202de2 100644 --- a/tests/Unit/Repository/MessageDecorator/TraceDecoratorTest.php +++ b/tests/Unit/Debug/Trace/TraceDecoratorTest.php @@ -2,19 +2,19 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\Tests\Unit\Repository\MessageDecorator; +namespace Patchlevel\EventSourcing\Tests\Unit\Debug\Trace; +use Patchlevel\EventSourcing\Debug\Trace\Trace; +use Patchlevel\EventSourcing\Debug\Trace\TraceDecorator; +use Patchlevel\EventSourcing\Debug\Trace\TraceHeader; +use Patchlevel\EventSourcing\Debug\Trace\TraceStack; use Patchlevel\EventSourcing\EventBus\HeaderNotFound; use Patchlevel\EventSourcing\EventBus\Message; -use Patchlevel\EventSourcing\Repository\MessageDecorator\Trace; -use Patchlevel\EventSourcing\Repository\MessageDecorator\TraceDecorator; -use Patchlevel\EventSourcing\Repository\MessageDecorator\TraceHeader; -use Patchlevel\EventSourcing\Repository\MessageDecorator\TraceStack; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; use stdClass; -/** @covers \Patchlevel\EventSourcing\Repository\MessageDecorator\TraceDecorator */ +/** @covers \Patchlevel\EventSourcing\Debug\Trace\TraceDecorator */ final class TraceDecoratorTest extends TestCase { use ProphecyTrait; diff --git a/tests/Unit/Repository/MessageDecorator/TraceStackTest.php b/tests/Unit/Debug/Trace/TraceStackTest.php similarity index 64% rename from tests/Unit/Repository/MessageDecorator/TraceStackTest.php rename to tests/Unit/Debug/Trace/TraceStackTest.php index f348e3534..b817521ad 100644 --- a/tests/Unit/Repository/MessageDecorator/TraceStackTest.php +++ b/tests/Unit/Debug/Trace/TraceStackTest.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Patchlevel\EventSourcing\Tests\Unit\Repository\MessageDecorator; +namespace Patchlevel\EventSourcing\Tests\Unit\Debug\Trace; -use Patchlevel\EventSourcing\Repository\MessageDecorator\Trace; -use Patchlevel\EventSourcing\Repository\MessageDecorator\TraceStack; +use Patchlevel\EventSourcing\Debug\Trace\Trace; +use Patchlevel\EventSourcing\Debug\Trace\TraceStack; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; -/** @covers \Patchlevel\EventSourcing\Repository\MessageDecorator\TraceStack */ +/** @covers \Patchlevel\EventSourcing\Debug\Trace\TraceStack */ final class TraceStackTest extends TestCase { use ProphecyTrait; From 0cec9f6e0d6bb37473c1100a13bb2bc07ca7082e Mon Sep 17 00:00:00 2001 From: David Badura Date: Wed, 13 Mar 2024 10:59:02 +0100 Subject: [PATCH 2/2] fix deptrac --- Makefile | 7 +++++-- deptrac-baseline.yaml | 7 ------- deptrac.yaml | 9 +++++++++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index ef77c0250..d50ed25b1 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,9 @@ help: vendor: composer.lock composer install +vendor-tools: tools/composer.lock + cd tools && composer install + .PHONY: cs-check cs-check: vendor ## run phpcs vendor/bin/phpcs @@ -49,11 +52,11 @@ infection: vendor vendor/bin/infection .PHONY: deptrac -deptrac: tools/vendor ## run deptrac +deptrac: vendor-tools ## run deptrac cd tools && ./vendor/bin/deptrac -c ../deptrac.yaml .PHONY: deptrac-baseline -deptrac-baseline: tools/vendor ## run deptrac and update baseline +deptrac-baseline: vendor-tools ## run deptrac and update baseline cd tools && ./vendor/bin/deptrac -c ../deptrac.yaml --formatter=baseline --output=../deptrac-baseline.yaml .PHONY: static diff --git a/deptrac-baseline.yaml b/deptrac-baseline.yaml index 3ca07909c..bf6fd70df 100644 --- a/deptrac-baseline.yaml +++ b/deptrac-baseline.yaml @@ -6,10 +6,3 @@ deptrac: - Patchlevel\EventSourcing\Subscription\RunMode Patchlevel\EventSourcing\Attribute\Subscriber: - Patchlevel\EventSourcing\Subscription\RunMode - Patchlevel\EventSourcing\Repository\MessageDecorator\TraceHeader: - - Patchlevel\EventSourcing\Attribute\Header - Patchlevel\EventSourcing\Subscription\Subscriber\TraceableSubscriberAccessor: - - Patchlevel\EventSourcing\Repository\MessageDecorator\Trace - - Patchlevel\EventSourcing\Repository\MessageDecorator\TraceStack - Patchlevel\EventSourcing\Subscription\Subscriber\TraceableSubscriberAccessorRepository: - - Patchlevel\EventSourcing\Repository\MessageDecorator\TraceStack diff --git a/deptrac.yaml b/deptrac.yaml index 9f3d031c1..3adc696c9 100644 --- a/deptrac.yaml +++ b/deptrac.yaml @@ -21,6 +21,10 @@ deptrac: collectors: - type: directory value: src/Console/.* + - name: Debug + collectors: + - type: directory + value: src/Debug/.* - name: EventBus collectors: - type: directory @@ -100,6 +104,11 @@ deptrac: - Serializer - Store - Subscription + Debug: + - Attribute + - EventBus + - Repository + - Subscription EventBus: - Aggregate - Attribute