Skip to content

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 $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?

Copy link
Contributor Author

@viktorprogger viktorprogger May 4, 2025

Choose a reason for hiding this comment

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

I don't see any real-world use cases. Do you?

Copy link
Member

Choose a reason for hiding this comment

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

Message handlers may add metadata into the message

Copy link
Contributor Author

@viktorprogger viktorprogger Jul 14, 2025

Choose a reason for hiding this comment

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

They should wrap it into an envelope then.

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?

Copy link
Contributor Author

@viktorprogger viktorprogger May 4, 2025

Choose a reason for hiding this comment

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

I don't see any real-world use cases. Do you?

Copy link
Contributor Author

@viktorprogger viktorprogger Jul 14, 2025

Choose a reason for hiding this comment

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

Another question.
Why is this better than FooEnvelope::fromMessage($message) or new FooEnvelope()?

@codecov
Copy link

codecov bot commented May 4, 2025

Codecov Report

Attention: Patch coverage is 97.77778% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.47%. Comparing base (7ac5da4) to head (209ba7b).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/Message/Envelope.php 96.29% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #231      +/-   ##
============================================
+ Coverage     96.16%   96.47%   +0.30%     
+ Complexity      359      356       -3     
============================================
  Files            47       47              
  Lines           966      965       -1     
============================================
+ Hits            929      931       +2     
+ Misses           37       34       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@viktorprogger viktorprogger requested a review from xepozz May 8, 2025 11:25
@viktorprogger viktorprogger requested a review from samdark May 9, 2025 16:13
Copy link
Member

@vjik vjik left a comment

Choose a reason for hiding this comment

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

Seems, this PR significantly degraded performance (see benchmark CI).

@samdark
Copy link
Member

samdark commented May 13, 2025

The performance concern is valid.

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.

Message handlers may add metadata into the message

$this->assertSame('data', $envelope->getMetadata()['meta']);
}

public function testWithMessage(): void
Copy link
Member

Choose a reason for hiding this comment

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

I'd keep it

Copy link
Contributor Author

@viktorprogger viktorprogger Jul 14, 2025

Choose a reason for hiding this comment

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

Why is this better than FooEnvelope::fromMessage($message) or new FooEnvelope()?

@viktorprogger
Copy link
Contributor Author

@samdark @vjik Envelope stack creation slowdown was fixed here.
My local bench result comparing to master:
image

@samdark
Copy link
Member

samdark commented Jul 14, 2025

@viktorprogger benchmark is looking way better now. How about merging master into the PR branch?

@samdark samdark merged commit 7a7db7d into master Jul 16, 2025
26 checks passed
@samdark samdark deleted the convert-envelope-trait-to-abstract-class branch July 16, 2025 10:45
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.

5 participants