Completed
Push — master ( 4c1af7...741b75 )
by Ruud
21:53
created

BaseDbalFilterTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getQueryBuilder() 0 9 1
1
<?php
2
3
namespace Kunstmaan\AdminListBundle\Tests\AdminList\FilterType\DBAL;
4
5
use Doctrine\DBAL\Connection;
6
use Doctrine\DBAL\Query\Expression\ExpressionBuilder;
7
use Doctrine\DBAL\Query\QueryBuilder;
8
use PHPUnit\Framework\TestCase;
9
10
abstract class BaseDbalFilterTest extends TestCase
11
{
12
    public function getQueryBuilder()
13
    {
14
        $conn = $this->createMock(Connection::class);
15
        $expressionBuilder = new ExpressionBuilder($conn);
0 ignored issues
show
Documentation introduced by
$conn is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\DBAL\Connection>.

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...
16
17
        $conn->method('getExpressionBuilder')->willReturn($expressionBuilder);
18
19
        return new QueryBuilder($conn);
0 ignored issues
show
Documentation introduced by
$conn is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\DBAL\Connection>.

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...
20
    }
21
}
22