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.

ReflectionClassTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 21
dl 0
loc 42
rs 10
c 2
b 0
f 1
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testBuildWithoutProperties() 0 8 1
A testBuild() 0 21 1
A testProperties() 0 7 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Tests\Innmind\Reflection;
5
6
use Innmind\Reflection\{
7
    ReflectionClass,
0 ignored issues
show
Bug introduced by
The type Innmind\Reflection\ReflectionClass was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
    InjectionStrategy,
9
    InjectionStrategy\InjectionStrategies,
10
    InjectionStrategy\NamedMethodStrategy,
11
    InjectionStrategy\ReflectionStrategy,
12
    InjectionStrategy\SetterStrategy,
13
    Instanciator\ReflectionInstanciator,
14
    Instanciator,
15
};
16
use Fixtures\Innmind\Reflection\{
17
    NoConstructor,
18
    WithConstructor,
19
};
20
use Innmind\Immutable\Set;
21
use function Innmind\Immutable\unwrap;
22
use PHPUnit\Framework\TestCase;
23
24
class ReflectionClassTest extends TestCase
25
{
26
    public function testBuildWithoutProperties()
27
    {
28
        $r = ReflectionClass::of(NoConstructor::class);
29
30
        $o = $r->build();
31
32
        $this->assertInstanceOf(NoConstructor::class, $o);
33
        $this->assertSame(null, $o->a());
34
    }
35
36
    public function testBuild()
37
    {
38
        $o = ReflectionClass::of(NoConstructor::class)
39
            ->withProperty('a', 42)
40
            ->build();
41
42
        $this->assertInstanceOf(NoConstructor::class, $o);
43
        $this->assertSame(42, $o->a());
44
45
        $o = ReflectionClass::of(WithConstructor::class)
46
            ->withProperties(
47
                [
48
                    'a' => 24,
49
                    'b' => 66,
50
                ]
51
            )
52
            ->build();
53
54
        $this->assertInstanceOf(WithConstructor::class, $o);
55
        $this->assertSame(24, $o->a());
56
        $this->assertSame(66, $o->b());
57
    }
58
59
    public function testProperties()
60
    {
61
        $properties = ReflectionClass::of(WithConstructor::class)->properties();
62
63
        $this->assertInstanceOf(Set::class, $properties);
64
        $this->assertSame('string', (string) $properties->type());
65
        $this->assertSame(['a', 'b'], unwrap($properties));
66
    }
67
}
68