VerifyEmailController::__invoke()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 5
c 1
b 0
f 0
nc 3
nop 1
dl 0
loc 11
rs 10
1
<?php
2
3
namespace App\Http\Controllers\Auth;
4
5
use App\Http\Controllers\Controller;
6
use Illuminate\Auth\Events\Verified;
7
use Illuminate\Foundation\Auth\EmailVerificationRequest;
8
use Illuminate\Http\RedirectResponse;
9
10
class VerifyEmailController extends Controller
11
{
12
    /**
13
     * Mark the authenticated user's email address as verified.
14
     */
15
    public function __invoke(EmailVerificationRequest $request): RedirectResponse
16
    {
17
        if ($request->user()->hasVerifiedEmail()) {
0 ignored issues
show
Bug introduced by
The method user() does not exist on Illuminate\Foundation\Au...mailVerificationRequest. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        if ($request->/** @scrutinizer ignore-call */ user()->hasVerifiedEmail()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
18
            return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
19
        }
20
21
        if ($request->user()->markEmailAsVerified()) {
22
            event(new Verified($request->user()));
23
        }
24
25
        return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
26
    }
27
}
28