GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

WhoopsPrettyErrorReporter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 36
wmc 3
lcom 1
cbo 3
ccs 0
cts 14
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A reportError() 0 9 2
1
<?php
2
3
namespace Camspiers\LoggerBridge\ErrorReporter;
4
5
use Camspiers\LoggerBridge\EnvReporter\EnvReporter;
6
use Debug;
7
use Whoops\Handler\PrettyPageHandler;
8
use Whoops\Run;
9
10
/**
11
 * Class DebugErrorReporter
12
 */
13
class WhoopsPrettyErrorReporter implements ErrorReporter
14
{
15
    /**
16
     * @var \Whoops\Handler\PrettyPageHandler
17
     */
18
    protected $prettyHandler;
19
20
    /**
21
     * @var \Camspiers\LoggerBridge\EnvReporter\EnvReporter
22
     */
23
    protected $envReporter;
24
25
    /**
26
     * @param \Whoops\Handler\PrettyPageHandler               $prettyHandler
27
     * @param \Camspiers\LoggerBridge\EnvReporter\EnvReporter $envReporter
28
     */
29
    public function __construct(PrettyPageHandler $prettyHandler, EnvReporter $envReporter)
30
    {
31
        $this->prettyHandler = $prettyHandler;
32
        $this->envReporter = $envReporter;
33
    }
34
35
    /**
36
     * @param \Exception      $exception
37
     * @param \SS_HTTPRequest $request
38
     */
39
    public function reportError(\Exception $exception, \SS_HTTPRequest $request = null)
40
    {
41
        if (!$this->envReporter->isLive()) {
42
            $whoops = new Run();
43
            $whoops->pushHandler($this->prettyHandler)->handleException($exception);
0 ignored issues
show
Documentation introduced by
$this->prettyHandler is of type object<Whoops\Handler\PrettyPageHandler>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
$exception is of type object<Exception>, but the function expects a object<Throwable>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
44
        } else {
45
            Debug::friendlyError();
46
        }
47
    }
48
}
49