Completed
Push — 5.6 ( 889235...c60ee9 )
by Jeroen
27s queued 12s
created

BaseOrmFilterTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getQueryBuilder() 0 7 1
1
<?php
2
3
namespace Kunstmaan\AdminListBundle\Tests\AdminList\FilterType\ORM;
4
5
use Doctrine\ORM\EntityManagerInterface;
6
use Doctrine\ORM\Query\Expr;
7
use Doctrine\ORM\QueryBuilder;
8
use PHPUnit\Framework\TestCase;
9
10
abstract class BaseOrmFilterTest extends TestCase
11
{
12
    public function getQueryBuilder()
13
    {
14
        $em = $this->createMock(EntityManagerInterface::class);
15
        $em->method('getExpressionBuilder')->willReturn(new Expr());
16
17
        return new QueryBuilder($em);
0 ignored issues
show
Documentation introduced by
$em is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\ORM\EntityManagerInterface>.

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...
18
    }
19
}
20