Changes createMessage() into a new Symfony\Component\Mime\Email
-$email = $this->swift->createMessage('message');
+$email = new \Symfony\Component\Mime\Email();
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\SwiftMailer\Rector\MethodCall\SwiftCreateMessageToNewEmailRector;
return RectorConfig::configure()
->withRules([
SwiftCreateMessageToNewEmailRector::class,
]);