8000 minor #32078 [Messenger] make all stamps final and mark stamp not mea… · symfony/symfony@8124159 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8124159

Browse files
committed
minor #32078 [Messenger] make all stamps final and mark stamp not meant to be sent (Tobion)
This PR was merged into the 4.4 branch. Discussion ---------- [Messenger] make all stamps final and mark stamp not meant to be sent | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | | License | MIT | Doc PR | Some newer stamps were already final. This makes all of them final. Also marks all stamps that are not meant to be sent using the new `NonSendableStampInterface`. This makes it easier to see which stamps are actually important and required to persist in a queue for certain functionality, like the `BusNameStamp` for the `RoutableMessageBus` Commits ------- 013904b [Messenger] make all stamps final and mark stamp not meant to be sent
2 parents aa4385d + 013904b commit 8124159

10 files changed

+22
-20
lines changed

src/Symfony/Component/Messenger/Stamp/BusNameStamp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @author Ryan Weaver <ryan@symfonycasts.com>
2020
*/
21-
class BusNameStamp implements StampInterface
21+
final class BusNameStamp implements StampInterface
2222
{
2323
private $busName;
2424

src/Symfony/Component/Messenger/Stamp/DelayStamp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @experimental in 4.3
1818
*/
19-
class DelayStamp implements StampInterface
19+
final class DelayStamp implements StampInterface
2020
{
2121
private $delay;
2222

src/Symfony/Component/Messenger/Stamp/DispatchAfterCurrentBusStamp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
*
2121
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
2222
*/
23-
class DispatchAfterCurrentBusStamp implements StampInterface
23+
final class DispatchAfterCurrentBusStamp implements NonSendableStampInterface
2424
{
2525
}

src/Symfony/Component/Messenger/Stamp/HandledStamp.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
* Stamp identifying a message handled by the `HandleMessageMiddleware` middleware
1818
* and storing the handler returned value.
1919
*
20+
* This is used by synchronous command buses expecting a return value and the retry logic
21+
* to only execute handlers that didn't succeed.
22+
*
2023
* @see \Symfony\Component\Messenger\Middleware\HandleMessageMiddleware
24+
* @see \Symfony\Component\Messenger\HandleTrait
2125
*
2226
* @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
2327
*

src/Symfony/Component/Messenger/Stamp/ReceivedStamp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
* @experimental in 4.3
2727
*/
28-
final class ReceivedStamp implements StampInterface
28+
final class ReceivedStamp implements NonSendableStampInterface
2929
{
3030
private $transportName;
3131

src/Symfony/Component/Messenger/Stamp/RedeliveryStamp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
* @experimental in 4.3
2121
*/
22-
class RedeliveryStamp implements StampInterface
22+
final class RedeliveryStamp implements StampInterface
2323
{
2424
private $retryCount;
2525
private $senderClassOrAlias;

src/Symfony/Component/Messenger/Stamp/SentStamp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @experimental in 4.3
2222
*/
23-
final class SentStamp implements StampInterface
23+
final class SentStamp implements NonSendableStampInterface
2424
{
2525
private $senderClass;
2626
private $senderAlias;

src/Symfony/Component/Messenger/Stamp/SentToFailureTransportStamp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @experimental in 4.3
2020
*/
21-
class SentToFailureTransportStamp implements StampInterface
21+
final class SentToFailureTransportStamp implements StampInterface
2222
{
2323
private $originalReceiverName;
2424

src/Symfony/Component/Messenger/Stamp/TransportMessageIdStamp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @experimental in 4.3
2020
*/
21-
class TransportMessageIdStamp implements StampInterface
21+
final class TransportMessageIdStamp implements StampInterface
2222
{
2323
private $id;
2424

src/Symfony/Component/Messenger/Tests/EnvelopeTest.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ public function testWithoutStampsOfType()
5555
{
5656
$envelope = new Envelope(new DummyMessage('dummy'), [
5757
new ReceivedStamp('transport1'),
58-
new DelayStamp(5000),
59-
new DummyExtendsDelayStamp(5000),
60-
new DummyImplementsFooBarStampInterface(),
58+
new DummyExtendsFooBarStamp(),
59+
new DummyImplementsFooBarStamp(),
6160
]);
6261

6362
$envelope2 = $envelope->withoutStampsOfType(DummyNothingImplementsMeStampInterface::class);
@@ -66,12 +65,11 @@ public function testWithoutStampsOfType()
6665
$envelope3 = $envelope2->withoutStampsOfType(ReceivedStamp::class);
6766
$this->assertEmpty($envelope3->all(ReceivedStamp::class));
6867

69-
$envelope4 = $envelope3->withoutStampsOfType(DelayStamp::class);
70-
$this->assertEmpty($envelope4->all(DelayStamp::class));
71-
$this->assertEmpty($envelope4->all(DummyExtendsDelayStamp::class));
68+
$envelope4 = $envelope3->withoutStampsOfType(DummyImplementsFooBarStamp::class);
69+
$this->assertEmpty($envelope4->all(DummyImplementsFooBarStamp::class));
70+
$this->assertEmpty($envelope4->all(DummyExtendsFooBarStamp::class));
7271

73-
$envelope5 = $envelope4->withoutStampsOfType(DummyFooBarStampInterface::class);
74-
$this->assertEmpty($envelope5->all(DummyImplementsFooBarStampInterface::class));
72+
$envelope5 = $envelope3->withoutStampsOfType(DummyFooBarStampInterface::class);
7573
$this->assertEmpty($envelope5->all());
7674
}
7775

@@ -118,15 +116,15 @@ public function testWrapWithEnvelope()
118116
}
119117
}
120118

121-
class DummyExtendsDelayStamp extends DelayStamp
122-
{
123-
}
124119
interface DummyFooBarStampInterface extends StampInterface
125120
{
126121
}
127122
interface DummyNothingImplementsMeStampInterface extends StampInterface
128123
{
129124
}
130-
class DummyImplementsFooBarStampInterface implements DummyFooBarStampInterface
125+
class DummyImplementsFooBarStamp implements DummyFooBarStampInterface
126+
{
127+
}
128+
class DummyExtendsFooBarStamp extends DummyImplementsFooBarStamp
131129
{
132130
}

0 commit comments

Comments
 (0)
0