hostbrook / laravel-dkim

Sign all outgoing emails in Laravel 9.x with a DKIM signature.
https://github.com/hostbrook/laravel-dkim
MIT License
0 stars 2 forks source link

Wrong return type in Mailer.php #4

Open sergeybhub opened 10 months ago

sergeybhub commented 10 months ago
 TypeError 

  HostBrook\LaravelDkim\Mailer::send(): Return value must be of type ?Illuminate\Mail\SentMessage, string returned

  at vendor/hostbrook/laravel-dkim/src/Mailer.php:30

public function send($view, array $data = [], $callback = null): ?SentMessage
{
        if ($view instanceof MailableContract) {
             return $this->sendMailable($view);
         }

I found these lines in sendMailable:

protected function sendMailable(MailableContract $mailable)
    {
        return $mailable instanceof ShouldQueue
                        ? $mailable->mailer($this->name)->queue($this->queue)
                        : $mailable->mailer($this->name)->send($this);
    }

and in my case (ShouldQueue) it returns string, as I see.

laravel 10.23.0

Maybe we can remove ?SendMessage to fix this?

hostbrook commented 10 months ago

wait, in the case of ShouldQueue - how the result of $mailable->mailer($this->name)->queue($this->queue) can be a string? it doesn't make any sense, isn't it?