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.

JobErrorHandler::handleError()   B
last analyzed

Complexity

Conditions 8
Paths 10

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 8.4444
c 0
b 0
f 0
cc 8
nc 10
nop 4
1
<?php
2
3
namespace Symbiote\QueuedJobs\Services;
4
5
use Exception;
6
7
/**
8
 * Class used to handle errors for a single job
9
 */
10
class JobErrorHandler
11
{
12
    public function __construct()
13
    {
14
        set_error_handler(array($this, 'handleError'));
15
    }
16
17
    public function clear()
18
    {
19
        restore_error_handler();
20
    }
21
22
    public function handleError($errno, $errstr, $errfile, $errline)
23
    {
24
        if (error_reporting()) {
25
            // Don't throw E_DEPRECATED in PHP 5.3+
26
            if (defined('E_DEPRECATED')) {
27
                if ($errno == E_DEPRECATED || $errno = E_USER_DEPRECATED) {
28
                    return;
29
                }
30
            }
31
32
            switch ($errno) {
33
                case E_NOTICE:
34
                case E_USER_NOTICE:
35
                case E_STRICT:
36
                    break;
37
                default:
38
                    throw new Exception($errstr . " in $errfile at line $errline", $errno);
39
                    break;
0 ignored issues
show
Unused Code introduced by
break; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
40
            }
41
        }
42
    }
43
}
44