From f868d3d8cef04d67df41bf9406c7334c3be6b3f3 Mon Sep 17 00:00:00 2001 From: David Badura Date: Wed, 7 Feb 2024 11:01:13 +0100 Subject: [PATCH] remove event bus stack & some small improvements --- src/Console/InvalidArgumentGiven.php | 4 ++-- src/EventBus/EventBusStackBuilder.php | 30 --------------------------- src/Outbox/DoctrineOutboxStore.php | 3 +-- src/Outbox/OutboxHeaderIssue.php | 4 ++-- 4 files changed, 5 insertions(+), 36 deletions(-) delete mode 100644 src/EventBus/EventBusStackBuilder.php diff --git a/src/Console/InvalidArgumentGiven.php b/src/Console/InvalidArgumentGiven.php index 0e4a76560..9ad39b202 100644 --- a/src/Console/InvalidArgumentGiven.php +++ b/src/Console/InvalidArgumentGiven.php @@ -6,7 +6,7 @@ use InvalidArgumentException; -use function gettype; +use function get_debug_type; use function sprintf; final class InvalidArgumentGiven extends InvalidArgumentException @@ -19,7 +19,7 @@ public function __construct( sprintf( 'Invalid argument given: need type "%s" got "%s"', $need, - gettype($value), + get_debug_type($value), ), ); } diff --git a/src/EventBus/EventBusStackBuilder.php b/src/EventBus/EventBusStackBuilder.php deleted file mode 100644 index 2d6e7efcc..000000000 --- a/src/EventBus/EventBusStackBuilder.php +++ /dev/null @@ -1,30 +0,0 @@ - */ - private array $stack = []; - - public function addFist(EventBus $eventBus): self - { - $this->stack = [$eventBus, ...$this->stack]; - - return $this; - } - - public function addLast(EventBus $eventBus): self - { - $this->stack[] = $eventBus; - - return $this; - } - - public function build(): EventBus - { - return new ChainEventBus($this->stack); - } -} diff --git a/src/Outbox/DoctrineOutboxStore.php b/src/Outbox/DoctrineOutboxStore.php index db0fbc0ea..a722211c9 100644 --- a/src/Outbox/DoctrineOutboxStore.php +++ b/src/Outbox/DoctrineOutboxStore.php @@ -60,8 +60,7 @@ public function retrieveOutboxMessages(int|null $limit = null): array function (array $data) { $message = $this->messageSerializer->deserialize($data['message']); - return $message - ->withCustomHeader(self::HEADER_OUTBOX_IDENTIFIER, $data['id']); + return $message->withCustomHeader(self::HEADER_OUTBOX_IDENTIFIER, $data['id']); }, $result, ); diff --git a/src/Outbox/OutboxHeaderIssue.php b/src/Outbox/OutboxHeaderIssue.php index 817e1d8c2..0a755d51b 100644 --- a/src/Outbox/OutboxHeaderIssue.php +++ b/src/Outbox/OutboxHeaderIssue.php @@ -6,7 +6,7 @@ use RuntimeException; -use function gettype; +use function get_debug_type; use function sprintf; final class OutboxHeaderIssue extends RuntimeException @@ -18,6 +18,6 @@ public static function missingHeader(string $header): self public static function invalidHeaderType(mixed $value): self { - return new self(sprintf('Invalid header given: need type "int" got "%s"', gettype($value))); + return new self(sprintf('Invalid header given: need type "int" got "%s"', get_debug_type($value))); } }