Skip to content

Commit

Permalink
fix watch command & message output
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBadura committed Mar 6, 2024
1 parent afc4913 commit bc9648b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/Console/Command/WatchCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,9 @@ function () use ($console, &$index, $aggregate, $aggregateId): void {

foreach ($stream as $message) {
$console->message($this->serializer, $message);
$index = $stream->index();
}

$index = $stream->index();

$stream->close();
},
[],
Expand Down
10 changes: 8 additions & 2 deletions src/Console/OutputStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ public function message(EventSerializer $serializer, Message $message): void

$headers = $message->headers();

if (isset($headers['recordedOn']) && $headers['recordedOn'] instanceof DateTimeInterface) {
$headers['recordedOn'] = $headers['recordedOn']->format(DateTimeInterface::ATOM);
foreach ($headers as $key => $value) {

Check failure on line 46 in src/Console/OutputStyle.php

View workflow job for this annotation

GitHub Actions / Static Analysis by Psalm (locked, 8.3, ubuntu-latest)

MixedAssignment

src/Console/OutputStyle.php:46:38: MixedAssignment: Unable to determine the type that $value is being assigned to (see https://psalm.dev/032)
if ($value instanceof DateTimeInterface) {
$headers[$key] = $value->format(DateTimeInterface::ATOM);
}

if (is_array($value) || is_object($value)) {

Check failure on line 51 in src/Console/OutputStyle.php

View workflow job for this annotation

GitHub Actions / Static Analysis by PHPStan (locked, 8.3, ubuntu-latest)

Call to function is_array() with bool|DateTimeImmutable|int<1, max>|string will always evaluate to false.
$headers[$key] = json_encode($value, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT);
}
}

$this->horizontalTable(array_keys($headers), [array_values($headers)]);
Expand Down

0 comments on commit bc9648b

Please sign in to comment.