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 master (993dc1)
by Baptiste
07:34 queued 03:48
created

ConstructorLessInstanciator::build()   A

Complexity

Conditions 2
Paths 3

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.7462

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 3
cts 7
cp 0.4286
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 11
nc 3
nop 2
crap 2.7462
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Reflection\Instanciator;
5
6
use Innmind\Reflection\{
7
    InstanciatorInterface,
8
    Exception\InstanciationFailedException
9
};
10
use Innmind\Immutable\{
11
    CollectionInterface,
12
    Collection
13
};
14
15
final class ConstructorLessInstanciator implements InstanciatorInterface
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 2
    public function build(string $class, CollectionInterface $properties)
21
    {
22
        try {
23 2
            $refl = new \ReflectionClass($class);
24
25 2
            return $refl->newInstanceWithoutConstructor();
26
        } catch (\TypeError $e) {
27
            throw new InstanciationFailedException(
28
                sprintf(
29
                    'Class "%s" cannot be instanciated',
30
                    $class
31
                ),
32
                $e->getCode(),
33
                $e
34
            );
35
        }
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41 2
    public function getParameters(string $class): CollectionInterface
42
    {
43 2
        return new Collection([]);
0 ignored issues
show
Deprecated Code introduced by
The class Innmind\Immutable\Collection has been deprecated with message: To be removed in 2.0

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
44
    }
45
}
46