Skip to content

phpstan error in MessageConverter::toEmail($message->getOriginalMessage()); #60273

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

Closed
spidgorny opened this issue Apr 25, 2025 · 1 comment
Closed

Comments

@spidgorny
Copy link

Symfony version(s) affected

12.10.2

Description

I've implemented a custom mail transport as described here:
https://laravel.com/docs/12.x/mail#custom-transports

The example on the documentation page shows how to convert SentMessage to Email object:

$email = MessageConverter::toEmail($message->getOriginalMessage());

phpstan (level 5) complains about the data types:

app/Mail/Transports/SESTransport.php:23:Parameter #1 $message of static method Symfony\Component\Mime\MessageConverter::toEmail() expects Symfony\Component\Mime\Message, Symfony\Component\Mime\RawMessage given.

It seems that phpstan is right, the data types are not strictly compatible.
It actually works without crashing though.
I know I can ignore this phpstan issue, but it would be nice to have it fixed.

How to reproduce

  • Implement the custom mail transport like in the documentation (copy/paste) from the link above.
  • Run phpstan with level 5

Possible Solution

No response

Additional Context

No response

@xabbuh
Copy link
Member

xabbuh commented Apr 25, 2025

This looks like something that you should report to the Laravel project then I guess. Symfony doesn't maintain their documentation.

@xabbuh xabbuh closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants