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   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 31
ccs 5
cts 9
cp 0.5556
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 17 2
A getParameters() 0 4 1
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