1 | <?php |
||||
2 | |||||
3 | namespace Fouladgar\MobileVerification\Http\Middleware; |
||||
4 | |||||
5 | use Closure; |
||||
6 | use Fouladgar\MobileVerification\Contracts\MustVerifyMobile; |
||||
7 | |||||
8 | class EnsureMobileIsVerified |
||||
9 | { |
||||
10 | /** |
||||
11 | * Handle an incoming request. |
||||
12 | * |
||||
13 | * @param $request |
||||
14 | * @param Closure $next |
||||
15 | * @param null $redirectToRoute |
||||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||||
16 | * |
||||
17 | * @return mixed|void |
||||
18 | */ |
||||
19 | public function handle($request, Closure $next, $redirectToRoute = null) |
||||
0 ignored issues
–
show
The parameter
$redirectToRoute is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
20 | { |
||||
21 | $user = auth()->user(); |
||||
22 | |||||
23 | if (! $user || ($user instanceof MustVerifyMobile && ! $user->hasVerifiedMobile())) { |
||||
24 | return $request->expectsJson() |
||||
25 | ? abort(403, 'Your mobile number is not verified.') |
||||
0 ignored issues
–
show
Are you sure the usage of
abort(403, 'Your mobile number is not verified.') is correct as it seems to always return null .
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. ![]() |
|||||
26 | : redirect('/')->withErrors(['mobile' => 'Your mobile number is not verified.']); |
||||
27 | } |
||||
28 | |||||
29 | return $next($request); |
||||
30 | } |
||||
31 | } |
||||
32 |