Completed
Push — master ( 94434d...92e1c0 )
by Şəhriyar
116:27 queued 99:47
created

app/Listeners/Users/SendActivationLinkViaEmail.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php namespace App\Listeners\Users;
2
3
use Illuminate\Mail\Message;
4
5
class SendActivationLinkViaEmail
6
{
7 2
    public function handle($event) // Don't type-hint: this listener can be triggered by different events.
8
    {
9
        /** @var \App\Models\User $user */
10 2
        $user = $event->user;
11 2
        if (false === ($activation = app('sentinel.activations')->exists($user))) {
12 1
            $activation = app('sentinel.activations')->create($event->user);
13 1
        }
14 2
        $token = $activation->code;
15 2
        $view = config('cartalyst.sentinel.activations.view');
16 2
        app('mailer')->send($view, compact('user', 'token'), function (Message $m) use ($user, $token) {
17 2
            $m->to($user->email)->subject($this->getActivationEmailSubject());
0 ignored issues
show
It seems like $this->getActivationEmailSubject() targeting App\Listeners\Users\Send...ctivationEmailSubject() can also be of type object<Symfony\Component...on\TranslatorInterface>; however, Illuminate\Mail\Message::subject() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
18 2
        });
19 2
    }
20
21
    /**
22
     * Get the e-mail subject line to be used for the reset link email.
23
     *
24
     * @return string
25
     */
26 2
    private function getActivationEmailSubject()
27
    {
28 2
        return trans('auth.activation_email_subject');
29
    }
30
}
31