ValueTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 1
dl 0
loc 11
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testDefaultValue() 0 8 1
1
<?php
2
/**
3
 * This file is part of the silex-annotation-provider package.
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 *
7
 * @license       MIT License
8
 * @copyright (c) 2018, Dana Desrosiers <[email protected]>
9
 */
10
11
namespace DDesrosiers\Test\SilexAnnotations\Annotations;
12
13
use DDesrosiers\Test\SilexAnnotations\AnnotationTestBase;
14
15
class ValueTest extends AnnotationTestBase
16
{
17
    public function testDefaultValue()
18
    {
19
        $this->assertEndPointStatus(self::GET_METHOD, "/foo", self::STATUS_OK);
20
21
        $response = $this->makeRequest(self::GET_METHOD, "/");
22
        $this->assertStatus($response, self::STATUS_OK);
0 ignored issues
show
Documentation introduced by
$response is of type object|null, but the function expects a object<Symfony\Component\HttpFoundation\Response>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
23
        $this->assertEquals('default', $response->getContent());
24
    }
25
}
26