diff --git a/src/Symfony/Component/Mailer/Transport.php b/src/Symfony/Component/Mailer/Transport.php index a57225ed2f65e..6a65a7289bcbb 100644 --- a/src/Symfony/Component/Mailer/Transport.php +++ b/src/Symfony/Component/Mailer/Transport.php @@ -38,10 +38,8 @@ /** * @author Fabien Potencier * @author Konstantin Myakshin - * - * @final since Symfony 5.4 */ -class Transport +final class Transport { private const FACTORY_CLASSES = [ GmailTransportFactory::class, @@ -56,33 +54,15 @@ class Transport private $factories; - /** - * @param EventDispatcherInterface|null $dispatcher - * @param HttpClientInterface|null $client - * @param LoggerInterface|null $logger - */ - public static function fromDsn(string $dsn/*, EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null*/): TransportInterface + public static function fromDsn(string $dsn, EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null): TransportInterface { - $dispatcher = 2 <= \func_num_args() ? func_get_arg(1) : null; - $client = 3 <= \func_num_args() ? func_get_arg(2) : null; - $logger = 4 <= \func_num_args() ? func_get_arg(3) : null; - $factory = new self(iterator_to_array(self::getDefaultFactories($dispatcher, $client, $logger))); return $factory->fromString($dsn); } - /** - * @param EventDispatcherInterface|null $dispatcher - * @param HttpClientInterface|null $client - * @param LoggerInterface|null $logger - */ - public static function fromDsns(array $dsns/*, EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null*/): TransportInterface + public static function fromDsns(array $dsns, EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null): TransportInterface { - $dispatcher = 2 <= \func_num_args() ? func_get_arg(1) : null; - $client = 3 <= \func_num_args() ? func_get_arg(2) : null; - $logger = 4 <= \func_num_args() ? func_get_arg(3) : null; - $factory = new self(iterator_to_array(self::getDefaultFactories($dispatcher, $client, $logger))); return $factory->fromStrings($dsns); @@ -175,18 +155,10 @@ public function fromDsnObject(Dsn $dsn): TransportInterface } /** - * @param EventDispatcherInterface|null $dispatcher - * @param HttpClientInterface|null $client - * @param LoggerInterface|null $logger - * * @return \Traversable */ - public static function getDefaultFactories(/*EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null*/): iterable + public static function getDefaultFactories(EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null, LoggerInterface $logger = null): \Traversable { - $dispatcher = 1 <= \func_num_args() ? func_get_arg(0) : null; - $client = 2 <= \func_num_args() ? func_get_arg(1) : null; - $logger = 3 <= \func_num_args() ? func_get_arg(2) : null; - foreach (self::FACTORY_CLASSES as $factoryClass) { if (class_exists($factoryClass)) { yield new $factoryClass($dispatcher, $client, $logger);