Issues (166)

app/Exceptions/Handler.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace App\Exceptions;
4
5
use Exception;
6
use Symfony\Component\HttpKernel\Exception\HttpException;
7
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
8
9
class Handler extends ExceptionHandler
10
{
11
    /**
12
     * A list of the exception types that should not be reported.
13
     *
14
     * @var array
15
     */
16
    protected $dontReport = [
17
        HttpException::class,
18
    ];
19
20
    /**
21
     * Report or log an exception.
22
     *
23
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
24
     *
25
     * @param  \Exception  $e
26
     * @return void
27
     */
28
    public function report(Exception $e)
29
    {
30
        // sentry logging
31
        if (app()->bound('sentry') && $this->shouldReport($e)) {
32
            app('sentry')->captureException($e);
33
        }
34
        return parent::report($e);
0 ignored issues
show
Are you sure the usage of parent::report($e) targeting Illuminate\Foundation\Exceptions\Handler::report() 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 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.

Loading history...
35
    }
36
37
    /**
38
     * Render an exception into an HTTP response.
39
     *
40
     * @param  \Illuminate\Http\Request  $request
41
     * @param  \Exception  $e
42
     * @return \Illuminate\Http\Response
43
     */
44
    public function render($request, Exception $e)
45
    {
46
        return parent::render($request, $e);
47
    }
48
}
49