Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert envelope trait to abstract class #231

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

viktorprogger
Copy link
Contributor

No description provided.

@viktorprogger viktorprogger self-assigned this Dec 15, 2024
@viktorprogger viktorprogger mentioned this pull request Dec 15, 2024
{
return [];
}
abstract protected function getEnvelopeMetadata(): array;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's good to keep default empty array

@@ -37,12 +37,4 @@ public function getMetadata(): array
{
return $this->metadata;
}

public function withMetadata(array $metadata): self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

private MessageInterface $message,
private array $meta = [],
MessageInterface $message,
private readonly array $failureMeta = [],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private readonly array $failureMeta = [],
private readonly array $metadata = [],

@@ -23,14 +20,6 @@ public function getMessage(): MessageInterface
return $this->message;
}

public function withMessage(MessageInterface $message): self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

$meta[self::FAILURE_META_KEY] = array_merge($meta[self::FAILURE_META_KEY] ?? [], $this->meta);

return $meta;
return [self::FAILURE_META_KEY => ArrayHelper::merge($this->message->getMetadata()[self::FAILURE_META_KEY] ?? [], $this->failureMeta)];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as you can see getEnvelopeMetadata method must provide all the collected metadata, not only the owned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants