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.

ArrayParameterValue   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromJSONValue() 0 7 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sop\JWX\Parameter\Feature;
6
7
use Sop\JWX\Parameter\Parameter;
8
9
/**
10
 * Trait for parameters having an array value.
11
 */
12
trait ArrayParameterValue
13
{
14
    /**
15
     * Initialize from a JSON value.
16
     *
17
     * @param array $value
18
     *
19
     * @return static
20
     */
21 12
    public static function fromJSONValue($value): Parameter
22
    {
23 12
        if (!is_array($value)) {
24 4
            throw new \UnexpectedValueException(
25 4
                get_called_class() . ' expects an array parameter.');
26
        }
27 8
        return new static(...$value);
0 ignored issues
show
Unused Code introduced by
The call to Sop\JWX\Parameter\Featur...terValue::__construct() has too many arguments starting with $value. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
        return /** @scrutinizer ignore-call */ new static(...$value);

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. Please note the @ignore annotation hint above.

Loading history...
28
    }
29
}
30