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.
Completed
Branch v2 (a88462)
by Hilari
02:38
created

InvalidArgumentException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
1
<?php
2
3
namespace Cmp\Cache\Exceptions;
4
5
use Exception;
6
7
/**
8
 * Class CacheException
9
 *
10
 * @package Cmp\Cache\Exceptions
11
 */
12
class InvalidArgumentException extends CacheException
13
{
14
    const CODE = 1003;
15
16
    /**
17
     * CacheException constructor.
18
     *
19
     * @param string         $argument
20
     * @param string         $expected
21
     * @param string         $value
22
     * @param Exception|null $previous
23
     */
24
    public function __construct($argument, $expected, $value, Exception $previous = null)
25
    {
26
        parent::__construct(
27
            "The given argument $argument is invalid. The expected was $expected, got ".gettype($value), 
28
            static::CODE, 
0 ignored issues
show
Documentation introduced by
static::CODE is of type integer, but the function expects a null|object<Exception>.

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...
29
            $previous
0 ignored issues
show
Unused Code introduced by
The call to CacheException::__construct() has too many arguments starting with $previous.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
30
        );
31
    }
32
}
33