ConvertTest::testConvertCollection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 ConvertTest extends AnnotationTestBase
16
{
17
    public function testConvert()
18
    {
19
        $response = $this->makeRequest(self::GET_METHOD, '/test/convert/45');
20
        $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...
21
        $this->assertEquals("50", $response->getContent());
22
    }
23
24
    public function testConvertCollection()
25
    {
26
        $response = $this->makeRequest(self::GET_METHOD, '/convert/test/45');
27
        $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...
28
        $this->assertEquals("50", $response->getContent());
29
    }
30
}
31