GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 75bdf9...8faa57 )
by joseph
83:56 queued 81:04
created

TemplateEntityRepository   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A find() 0 8 3
A get() 0 7 2
A getOneBy() 0 8 2
A findOneBy() 0 8 3
1
<?php declare(strict_types=1);
2
3
namespace TemplateNamespace\Entity\Repositories;
4
5
use TemplateNamespace\Entity\Repositories\AbstractEntityRepository;
6
use TemplateNamespace\Entity\Interfaces\TemplateEntityInterface;
7
8
// phpcs:disable -- line length
9
class TemplateEntityRepository extends AbstractEntityRepository
10
{
11
// phpcs: enable
12
13
    public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?TemplateEntityInterface
14
    {
15
        $result = parent::find($id, $lockMode, $lockVersion);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as parent::find($id, $lockMode, $lockVersion) targeting EdmondsCommerce\Doctrine...ntityRepository::find() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
16
        if ($result === null || $result instanceof TemplateEntityInterface) {
0 ignored issues
show
introduced by
The condition $result === null is always true.
Loading history...
17
            return $result;
18
        }
19
20
        throw new \RuntimeException('Unknown entity type of ' . \get_class($result) . ' returned');
21
    }
22
23
    public function get($id, ?int $lockMode = null, ?int $lockVersion = null): TemplateEntityInterface
24
    {
25
        $result = parent::get($id, $lockMode, $lockVersion);
26
        if ($result instanceof TemplateEntityInterface) {
27
            return $result;
28
        }
29
        throw new \RuntimeException('Unknown entity type of ' . \get_class($result) . ' returned');
30
    }
31
32
    public function getOneBy(array $criteria, ?array $orderBy = null): TemplateEntityInterface
33
    {
34
        $result = $this->findOneBy($criteria, $orderBy);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as $this->findOneBy($criteria, $orderBy) targeting TemplateNamespace\Entity...Repository::findOneBy() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
35
        if ($result === null) {
0 ignored issues
show
introduced by
The condition $result === null is always true.
Loading history...
36
            throw new \RuntimeException('Could not find the entity');
37
        }
38
39
        return $result;
40
    }
41
42
    public function findOneBy(array $criteria, ?array $orderBy = null): ?TemplateEntityInterface
43
    {
44
        $result = parent::findOneBy($criteria, $orderBy);
0 ignored issues
show
Bug introduced by
Are you sure the assignment to $result is correct as parent::findOneBy($criteria, $orderBy) targeting EdmondsCommerce\Doctrine...Repository::findOneBy() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
45
        if ($result === null || $result instanceof TemplateEntityInterface) {
0 ignored issues
show
introduced by
The condition $result === null is always true.
Loading history...
46
            return $result;
47
        }
48
49
        throw new \RuntimeException('Unknown entity type of ' . \get_class($result) . ' returned');
50
    }
51
}
52