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

UserRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 7
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A find() 0 5 2
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