for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of Laravel Sense.
*
* (c) Anton Komarev <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Cog\Laravel\Sense\Http\Middleware;
use Cog\Laravel\Sense\Authentication\Services\Authenticator;
class Authenticate
{
/**
* Handle the incoming request.
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return \Illuminate\Http\Response|null
public function handle($request, $next)
return Authenticator::check($request) ? $next($request) : abort(403);
abort(403)
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 getObject() can return nothing but null, so it makes no sense to use the return value.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
}
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.