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
Push — 4.2-to-master ( ed215f )
by E
06:47
created

testReturnReference()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace ApiGen\Parser\Tests\Reflection;
4
5
use ApiGen\Contracts\Parser\Reflection\ParameterReflectionInterface;
6
use ApiGen\Parser\Reflection\AbstractReflectionFunction;
7
use ApiGen\Parser\Reflection\ReflectionParameter;
8
9
final class AbstractReflectionFunctionTest extends AbstractReflectionTestCase
10
{
11
    /**
12
     * @var AbstractReflectionFunction
13
     */
14
    private $reflectionFunction;
15
16
    protected function setUp(): void
17
    {
18
        parent::setUp();
19
        $this->broker->processDirectory(__DIR__ . '/ReflectionFunctionSource');
20
        $this->reflectionFunction = $this->backend->getFunctions()['getSomeData'];
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->backend->getFunctions()['getSomeData'] of type object<ApiGen\Contracts\...ionReflectionInterface> is incompatible with the declared type object<ApiGen\Parser\Ref...ractReflectionFunction> of property $reflectionFunction.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
21
    }
22
23
    public function testGetShortName(): void
24
    {
25
        $this->assertSame('getSomeData', $this->reflectionFunction->getShortName());
26
    }
27
28
    public function testReturnReference(): void
29
    {
30
        $this->assertFalse($this->reflectionFunction->returnsReference());
31
    }
32
33
    public function testGetParameters(): void
34
    {
35
        $parameters = $this->reflectionFunction->getParameters();
36
        $this->assertCount(1, $parameters);
37
38
        /** @var ReflectionParameter $parameter */
39
        $parameter = $parameters[0];
40
        $this->assertInstanceOf(ParameterReflectionInterface::class, $parameter);
41
    }
42
43
    public function testGetParameter(): void
44
    {
45
        $parameter = $this->reflectionFunction->getParameter('arg');
46
        $this->assertInstanceOf(ParameterReflectionInterface::class, $parameter);
47
48
        $parameter = $this->reflectionFunction->getParameter(0);
49
        $this->assertInstanceOf(ParameterReflectionInterface::class, $parameter);
50
    }
51
52
    /**
53
     * @expectedException \InvalidArgumentException
54
     */
55
    public function testGetParameterNotExistingName(): void
56
    {
57
        $this->reflectionFunction->getParameter('notHere');
58
    }
59
60
    /**
61
     * @expectedException \InvalidArgumentException
62
     */
63
    public function testGetParameterNotExistingPosition(): void
64
    {
65
        $this->reflectionFunction->getParameter(1);
66
    }
67
68
    public function testGetParametersAnnotationMatchingRealCount(): void
69
    {
70
        $reflectionFunction = $this->backend->getFunctions()['getMemoryInBytes'];
71
72
        $parameters = $reflectionFunction->getParameters();
73
        $this->assertCount(1, $parameters);
74
75
        $this->assertFalse($parameters[0]->isUnlimited());
76
    }
77
}
78