From 86b22357eb73d85b3e2331c6fb0f85492c2b4e69 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas <nicolas.grekas@gmail.com>
Date: Thu, 31 Mar 2022 10:18:50 +0200
Subject: [PATCH] [Messenger][Security/Core] Remove legacy class aliases

---
 Transport/AmqpFactory.php          | 4 ----
 Transport/AmqpReceivedStamp.php    | 4 ----
 Transport/AmqpReceiver.php         | 4 ----
 Transport/AmqpSender.php           | 4 ----
 Transport/AmqpStamp.php            | 4 ----
 Transport/AmqpTransport.php        | 4 ----
 Transport/AmqpTransportFactory.php | 4 ----
 Transport/Connection.php           | 4 ----
 8 files changed, 32 deletions(-)

diff --git a/Transport/AmqpFactory.php b/Transport/AmqpFactory.php
index 47d8487..5cf6b06 100644
--- a/Transport/AmqpFactory.php
+++ b/Transport/AmqpFactory.php
@@ -33,7 +33,3 @@ public function createExchange(\AMQPChannel $channel): \AMQPExchange
         return new \AMQPExchange($channel);
     }
 }
-
-if (!class_exists(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpFactory::class, false)) {
-    class_alias(AmqpFactory::class, \Symfony\Component\Messenger\Transport\AmqpExt\AmqpFactory::class);
-}
diff --git a/Transport/AmqpReceivedStamp.php b/Transport/AmqpReceivedStamp.php
index d99c182..3b633d9 100644
--- a/Transport/AmqpReceivedStamp.php
+++ b/Transport/AmqpReceivedStamp.php
@@ -37,7 +37,3 @@ public function getQueueName(): string
         return $this->queueName;
     }
 }
-
-if (!class_exists(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpReceivedStamp::class, false)) {
-    class_alias(AmqpReceivedStamp::class, \Symfony\Component\Messenger\Transport\AmqpExt\AmqpReceivedStamp::class);
-}
diff --git a/Transport/AmqpReceiver.php b/Transport/AmqpReceiver.php
index 141ab8c..713eaef 100644
--- a/Transport/AmqpReceiver.php
+++ b/Transport/AmqpReceiver.php
@@ -144,7 +144,3 @@ private function findAmqpStamp(Envelope $envelope): AmqpReceivedStamp
         return $amqpReceivedStamp;
     }
 }
-
-if (!class_exists(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpReceiver::class, false)) {
-    class_alias(AmqpReceiver::class, \Symfony\Component\Messenger\Transport\AmqpExt\AmqpReceiver::class);
-}
diff --git a/Transport/AmqpSender.php b/Transport/AmqpSender.php
index 5fdfdff..7af8a87 100644
--- a/Transport/AmqpSender.php
+++ b/Transport/AmqpSender.php
@@ -80,7 +80,3 @@ public function send(Envelope $envelope): Envelope
         return $envelope;
     }
 }
-
-if (!class_exists(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpSender::class, false)) {
-    class_alias(AmqpSender::class, \Symfony\Component\Messenger\Transport\AmqpExt\AmqpSender::class);
-}
diff --git a/Transport/AmqpStamp.php b/Transport/AmqpStamp.php
index d065aaa..d7ef18b 100644
--- a/Transport/AmqpStamp.php
+++ b/Transport/AmqpStamp.php
@@ -88,7 +88,3 @@ public static function createWithAttributes(array $attributes, self $previousSta
         );
     }
 }
-
-if (!class_exists(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpStamp::class, false)) {
-    class_alias(AmqpStamp::class, \Symfony\Component\Messenger\Transport\AmqpExt\AmqpStamp::class);
-}
diff --git a/Transport/AmqpTransport.php b/Transport/AmqpTransport.php
index 9ffda47..b33105e 100644
--- a/Transport/AmqpTransport.php
+++ b/Transport/AmqpTransport.php
@@ -101,7 +101,3 @@ private function getSender(): AmqpSender
         return $this->sender = new AmqpSender($this->connection, $this->serializer);
     }
 }
-
-if (!class_exists(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransport::class, false)) {
-    class_alias(AmqpTransport::class, \Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransport::class);
-}
diff --git a/Transport/AmqpTransportFactory.php b/Transport/AmqpTransportFactory.php
index 420cf7a..f032309 100644
--- a/Transport/AmqpTransportFactory.php
+++ b/Transport/AmqpTransportFactory.php
@@ -32,7 +32,3 @@ public function supports(string $dsn, array $options): bool
         return 0 === strpos($dsn, 'amqp://') || 0 === strpos($dsn, 'amqps://');
     }
 }
-
-if (!class_exists(\Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory::class, false)) {
-    class_alias(AmqpTransportFactory::class, \Symfony\Component\Messenger\Transport\AmqpExt\AmqpTransportFactory::class);
-}
diff --git a/Transport/Connection.php b/Transport/Connection.php
index 7b742ce..102d7ae 100644
--- a/Transport/Connection.php
+++ b/Transport/Connection.php
@@ -559,7 +559,3 @@ private function getRoutingKeyForMessage(?AmqpStamp $amqpStamp): ?string
         return (null !== $amqpStamp ? $amqpStamp->getRoutingKey() : null) ?? $this->getDefaultPublishRoutingKey();
     }
 }
-
-if (!class_exists(\Symfony\Component\Messenger\Transport\AmqpExt\Connection::class, false)) {
-    class_alias(Connection::class, \Symfony\Component\Messenger\Transport\AmqpExt\Connection::class);
-}