Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Change type hints #31837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
changed type hints
  • Loading branch information
fabpot committed Jun 4, 2019
commit d56ae06ca3d26ee48485dba0079ea985cbca947f
9 changes: 1 addition & 8 deletions 9 src/Symfony/Component/Mailer/DelayedSmtpEnvelope.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

namespace Symfony\Component\Mailer;

use Symfony\Component\Mailer\Exception\InvalidArgumentException;
use Symfony\Component\Mailer\Exception\LogicException;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Header\Headers;
use Symfony\Component\Mime\Message;
use Symfony\Component\Mime\RawMessage;

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

public function __construct(RawMessage $message)
public function __construct(Message $message)
{
if (!$message instanceof Message) {
// FIXME: parse the raw message to create the envelope?
throw new InvalidArgumentException(sprintf('Unable to create an SmtpEnvelope from a "%s" message.', RawMessage::class));
}

$this->message = $message;
}

Expand Down
6 changes: 0 additions & 6 deletions 6 src/Symfony/Component/Mailer/Tests/SmtpEnvelopeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,4 @@ public function testRecipientsFromHeaders()
$e = SmtpEnvelope::create(new Message($headers));
$this->assertEquals([new Address('to@symfony.com'), new Address('cc@symfony.com'), new Address('bcc@symfony.com')], $e->getRecipients());
}

public function testCreateWithRawMessage()
{
$this->expectException(\InvalidArgumentException::class);
SmtpEnvelope::create(new RawMessage(''));
}
}
7 changes: 1 addition & 6 deletions 7 src/Symfony/Component/Mime/MessageConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,12 @@ final class MessageConverter
/**
* @throws RuntimeException when unable to convert the message to an email
*/
public static function toEmail(RawMessage $message): Email
public static function toEmail(Message $message): Email
{
if ($message instanceof Email) {
return $message;
}

if (RawMessage::class === \get_class($message)) {
// FIXME: parse the raw message to create the envelope?
throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as it is not supported yet.', RawMessage::class));
}

// try to convert to a "simple" Email instance
$body = $message->getBody();
if ($body instanceof TextPart) {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.