It seems like $envelope can also be of type null; however, parameter $envelope of Symfony\Component\Mailer...tMessage::__construct() does only seem to accept Symfony\Component\Mailer\Envelope, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
35
$sentMessage = new SentMessage($message, /** @scrutinizer ignore-type */ $envelope);