Skip to content

Commit d56ae06

Browse files
committed
changed type hints
1 parent f6a6fb6 commit d56ae06

File tree

3 files changed

+2
-20
lines changed

3 files changed

+2
-20
lines changed

src/Symfony/Component/Mailer/DelayedSmtpEnvelope.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111

1212
namespace Symfony\Component\Mailer;
1313

14-
use Symfony\Component\Mailer\Exception\InvalidArgumentException;
1514
use Symfony\Component\Mailer\Exception\LogicException;
1615
use Symfony\Component\Mime\Address;
1716
use Symfony\Component\Mime\Header\Headers;
1817
use Symfony\Component\Mime\Message;
19-
use Symfony\Component\Mime\RawMessage;
2018

2119
/**
2220
* @author Fabien Potencier <fabien@symfony.com>
@@ -31,13 +29,8 @@ final class DelayedSmtpEnvelope extends SmtpEnvelope
3129
private $recipientsSet = false;
3230
private $message;
3331

34-
public function __construct(RawMessage $message)
32+
public function __construct(Message $message)
3533
{
36-
if (!$message instanceof Message) {
37-
// FIXME: parse the raw message to create the envelope?
38-
throw new InvalidArgumentException(sprintf('Unable to create an SmtpEnvelope from a "%s" message.', RawMessage::class));
39-
}
40-
4134
$this->message = $message;
4235
}
4336

src/Symfony/Component/Mailer/Tests/SmtpEnvelopeTest.php

-6
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,4 @@ public function testRecipientsFromHeaders()
9191
$e = SmtpEnvelope::create(new Message($headers));
9292
$this->assertEquals([new Address('to@symfony.com'), new Address('cc@symfony.com'), new Address('bcc@symfony.com')], $e->getRecipients());
9393
}
94-
95-
public function testCreateWithRawMessage()
96-
{
97-
$this->expectException(\InvalidArgumentException::class);
98-
SmtpEnvelope::create(new RawMessage(''));
99-
}
10094
}

src/Symfony/Component/Mime/MessageConverter.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,12 @@ final class MessageConverter
2828
/**
2929
* @throws RuntimeException when unable to convert the message to an email
3030
*/
31-
public static function toEmail(RawMessage $message): Email
31+
public static function toEmail(Message $message): Email
3232
{
3333
if ($message instanceof Email) {
3434
return $message;
3535
}
3636

37-
if (RawMessage::class === \get_class($message)) {
38-
// FIXME: parse the raw message to create the envelope?
39-
throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as it is not supported yet.', RawMessage::class));
40-
}
41-
4237
// try to convert to a "simple" Email instance
4338
$body = $message->getBody();
4439
if ($body instanceof TextPart) {

0 commit comments

Comments
 (0)