Completed
Push — master ( 6cc2de...ecdd96 )
by Adrien
02:40
created

UserRepository::find()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GraphQLTests\Doctrine\Blog\Repository;
6
7
use GraphQLTests\Doctrine\Blog\Model\User;
8
9
/**
10
 * A fake repository so we don't have to set up a DB
11
 */
12
class UserRepository extends \Doctrine\ORM\EntityRepository
13
{
14
    public function find($id, $lockMode = null, $lockVersion = null): ?User
15
    {
16
        $id = (int) $id;
17
18
        return $id === 123 ? new User($id) : null;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $id === 123 ? new...\Model\User($id) : null also could return the type GraphQLTests\Doctrine\Blog\Model\User which is incompatible with the return type mandated by Doctrine\Common\Persiste...bjectRepository::find() of object|null.
Loading history...
19
    }
20
}
21