8000 minor #41421 [Messenger] remove legacy code paths (nicolas-grekas) · symfony/symfony@7954200 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7954200

Browse files
minor #41421 [Messenger] remove legacy code paths (nicolas-grekas)
This PR was merged into the 6.0 branch. Discussion ---------- [Messenger] remove legacy code paths | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Should make tests green. (and missed in #41319) Commits ------- 6d65673 [Messenger] remove legacy code paths
2 parents 63c1006 + 6d65673 commit 7954200

File tree

2 files changed

+3
-21
lines changed

2 files changed

+3
-21
lines changed

src/Symfony/Component/Messenger/Envelope.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function withoutAll(string $stampFqcn): self
7373
{
7474
$cloned = clone $this;
7575

76-
unset($cloned->stamps[$this->resolveAlias($stampFqcn)]);
76+
unset($cloned->stamps[$stampFqcn]);
7777

7878
return $cloned;
7979
}
@@ -84,7 +84,6 @@ public function withoutAll(string $stampFqcn): self
8484
public function withoutStampsOfType(string $type): self
8585
{
8686
$cloned = clone $this;
87-
$type = $this->resolveAlias($type);
8887

8988
foreach ($cloned->stamps as $class => $stamps) {
9089
if ($class === $type || is_subclass_of($class, $type)) {
@@ -97,7 +96,7 @@ public function withoutStampsOfType(string $type): self
9796

9897
public function last(string $stampFqcn): ?StampInterface
9998
{
100-
return isset($this->stamps[$stampFqcn = $this->resolveAlias($stampFqcn)]) ? end($this->stamps[$stampFqcn]) : null;
99+
return isset($this->stamps[$stampFqcn = $stampFqcn]) ? end($this->stamps[$stampFqcn]) : null;
101100
}
102101

103102
/**
@@ -106,7 +105,7 @@ public function last(string $stampFqcn): ?StampInterface
106105
public function all(string $stampFqcn = null): array
107106
{
108107
if (null !== $stampFqcn) {
109-
return $this->stamps[$this->resolveAlias($stampFqcn)] ?? [];
108+
return $this->stamps[$stampFqcn] ?? [];
110109
}
111110

112111
return $this->stamps;
@@ -119,14 +118,4 @@ public function getMessage(): object
119118
{
120119
return $this->message;
121120
}
122-
123-
/**
124-
* BC to be removed in 6.0.
125-
*/
126-
private function resolveAlias(string $fqcn): string
127-
{
128-
static $resolved;
129-
130-
return $resolved[$fqcn] ?? ($resolved[$fqcn] = (new \ReflectionClass($fqcn))->getName());
131-
}
132121
}

src/Symfony/Component/Messenger/Middleware/RejectRedeliveredMessageMiddleware.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpReceivedStamp;
1515
use Symfony\Component\Messenger\Envelope;
1616
use Symfony\Component\Messenger\Exception\RejectRedeliveredMessageException;
17-
use Symfony\Component\Messenger\Transport\AmqpExt\AmqpReceivedStamp as LegacyAmqpReceivedStamp;
1817

1918
/**
2019
* Middleware that throws a RejectRedeliveredMessageException when a message is detected that has been redelivered by AMQP.
@@ -39,12 +38,6 @@ public function handle(Envelope $envelope, StackInterface $stack): Envelope
3938
throw new RejectRedeliveredMessageException('Redelivered message from AMQP detected that will be rejected and trigger the retry logic.');
4039
}
4140

42-
// Legacy code to support symfony/messenger < 5.1
43-
$amqpReceivedStamp = $envelope->last(LegacyAmqpReceivedStamp::class);
44-
if ($amqpReceivedStamp instanceof LegacyAmqpReceivedStamp && $amqpReceivedStamp->getAmqpEnvelope()->isRedelivery()) {
45-
throw new RejectRedeliveredMessageException('Redelivered message from AMQP detected that will be rejected and trigger the retry logic.');
46-
}
47-
4841
return $stack->next()->handle($envelope, $stack);
4942
}
5043
}

0 commit comments

Comments
 (0)
0