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.

iatorTest.php$1   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 3
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 3
rs 10
c 1
b 0
f 1
wmc 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Tests\Innmind\Reflection\Instanciator;
5
6
use Innmind\Reflection\{
7
    Instanciator\ConstructorLessInstanciator,
8
    Instanciator,
9
};
10
use Innmind\Immutable\Map;
11
use function Innmind\Immutable\unwrap;
12
use PHPUnit\Framework\TestCase;
13
14
class ConstructorLessInstanciatorTest extends TestCase
15
{
16
    public function testInterface()
17
    {
18
        $this->assertInstanceOf(
19
            Instanciator::class,
20
            new ConstructorLessInstanciator
21
        );
22
    }
23
24
    public function testBuild()
25
    {
26
        $instanciator = new ConstructorLessInstanciator;
27
        $object = new class('bar') {
28
            public $foo;
29
30
            public function __construct(string $foo)
31
            {
32
                $this->foo = $foo;
33
            }
34
        };
35
36
        $this->assertInstanceOf(
37
            'stdClass',
38
            $instanciator->build(
39
                'stdClass',
40
                Map::of('string', 'variable')
41
            )
42
        );
43
44
        $builtObject = $instanciator->build(
45
            get_class($object),
46
            Map::of('string', 'variable')
47
        );
48
49
        $this->assertInstanceOf(get_class($object), $builtObject);
50
        $this->assertNull($builtObject->foo);
51
    }
52
53
    public function testGetParameters()
54
    {
55
        $instanciator = new ConstructorLessInstanciator;
56
        $object = new class('bar') {
57
            public function __construct(string $foo)
0 ignored issues
show
Unused Code introduced by
The parameter $foo is not used and could be removed. ( Ignorable by Annotation )

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

57
            public function __construct(/** @scrutinizer ignore-unused */ string $foo)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
58
            {
59
            }
60
        };
61
62
        $this->assertSame(
63
            [],
64
            unwrap($instanciator->parameters('stdClass')),
65
        );
66
        $this->assertSame(
67
            [],
68
            unwrap($instanciator->parameters(get_class($object))),
69
        );
70
    }
71
}
72