diff --git a/src/Symfony/Component/Messenger/Envelope.php b/src/Symfony/Component/Messenger/Envelope.php index aa56d1b584027..0663103b76052 100644 --- a/src/Symfony/Component/Messenger/Envelope.php +++ b/src/Symfony/Component/Messenger/Envelope.php @@ -73,7 +73,7 @@ public function withoutAll(string $stampFqcn): self { $cloned = clone $this; - unset($cloned->stamps[$this->resolveAlias($stampFqcn)]); + unset($cloned->stamps[$stampFqcn]); return $cloned; } @@ -84,7 +84,6 @@ public function withoutAll(string $stampFqcn): self public function withoutStampsOfType(string $type): self { $cloned = clone $this; - $type = $this->resolveAlias($type); foreach ($cloned->stamps as $class => $stamps) { if ($class === $type || is_subclass_of($class, $type)) { @@ -97,7 +96,7 @@ public function withoutStampsOfType(string $type): self public function last(string $stampFqcn): ?StampInterface { - return isset($this->stamps[$stampFqcn = $this->resolveAlias($stampFqcn)]) ? end($this->stamps[$stampFqcn]) : null; + return isset($this->stamps[$stampFqcn = $stampFqcn]) ? end($this->stamps[$stampFqcn]) : null; } /** @@ -106,7 +105,7 @@ public function last(string $stampFqcn): ?StampInterface public function all(string $stampFqcn = null): array { if (null !== $stampFqcn) { - return $this->stamps[$this->resolveAlias($stampFqcn)] ?? []; + return $this->stamps[$stampFqcn] ?? []; } return $this->stamps; @@ -119,14 +118,4 @@ public function getMessage(): object { return $this->message; } - - /** - * BC to be removed in 6.0. - */ - private function resolveAlias(string $fqcn): string - { - static $resolved; - - return $resolved[$fqcn] ?? ($resolved[$fqcn] = (new \ReflectionClass($fqcn))->getName()); - } } diff --git a/src/Symfony/Component/Messenger/Middleware/RejectRedeliveredMessageMiddleware.php b/src/Symfony/Component/Messenger/Middleware/RejectRedeliveredMessageMiddleware.php index 9e994ddd1e01d..06cd179de8992 100644 --- a/src/Symfony/Component/Messenger/Middleware/RejectRedeliveredMessageMiddleware.php +++ b/src/Symfony/Component/Messenger/Middleware/RejectRedeliveredMessageMiddleware.php @@ -14,7 +14,6 @@ use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpReceivedStamp; use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\Exception\RejectRedeliveredMessageException; -use Symfony\Component\Messenger\Transport\AmqpExt\AmqpReceivedStamp as LegacyAmqpReceivedStamp; /** * 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 throw new RejectRedeliveredMessageException('Redelivered message from AMQP detected that will be rejected and trigger the retry logic.'); } - // Legacy code to support symfony/messenger < 5.1 - $amqpReceivedStamp = $envelope->last(LegacyAmqpReceivedStamp::class); - if ($amqpReceivedStamp instanceof LegacyAmqpReceivedStamp && $amqpReceivedStamp->getAmqpEnvelope()->isRedelivery()) { - throw new RejectRedeliveredMessageException('Redelivered message from AMQP detected that will be rejected and trigger the retry logic.'); - } - return $stack->next()->handle($envelope, $stack); } }