Find the best Rector rule to solve your problem. Searching through 661 rules.

Found 3 rules:

SwiftSetBodyToHtmlPlainMethodCallRector

Changes setBody() method call on Swift_Message into a html() or plain() based on second argument

 $message = new Swift_Message();

-$message->setBody('...', 'text/html');
+$message->html('...');

-$message->setBody('...', 'text/plain');
-$message->setBody('...');
+$message->text('...');
+$message->text('...');

SwiftCreateMessageToNewEmailRector

Changes createMessage() into a new Symfony\Component\Mime\Email

-$email = $this->swift->createMessage('message');
+$email = new \Symfony\Component\Mime\Email();

SwiftMessageToEmailRector

Convert \Swift_Message into an \Symfony\Component\Mime\Email

-$message = (new \Swift_Message('Hello Email'))
-        ->setFrom('send@example.com')
-        ->setTo(['recipient@example.com' => 'Recipient'])
-        ->setBody(
-            $this->renderView(
-                'emails/registration.html.twig',
-                ['name' => $name]
-            ),
-            'text/html'
-        )
+$message = (new Email())
+    ->from(new Address('send@example.com'))
+    ->to(new Address('recipient@example.com', 'Recipient'))
+    ->subject('Hello Email')
+    ->html($this->renderView(
+        'emails/registration.html.twig',
+        ['name' => $name]
+    ))
+;