for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Exceptions;
use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
*/
protected $dontReport = [
//
];
* A list of the inputs that are never flashed for validation exceptions.
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
* Register the exception handling callbacks for the application.
* @return void
public function register()
$this->reportable(function (Throwable $e) {
$e
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
$this->reportable(function (/** @scrutinizer ignore-unused */ Throwable $e) {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
});
}
* Report or log an exception.
* @param \Exception $exception
public function report(Throwable $exception)
parent::report($exception);
* Render an exception into an HTTP response.
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
public function render($request, Throwable $exception)
if (!env("APP_DEBUG") && $request->is('api/*')) {
return response(json_encode([
'success' => false,
'message' => 'Server Error',
'ret' => [],
'err' => [
'code' => 500,
'msg' => 'Server Error',
'data'=>[]
]
]), 500)->header('Content-Type', 'application/json');
};
return parent::render($request, $exception);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.