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 ( 07a5d8...b7113a )
by joseph
32:24 queued 04:34
created

TemplateEntityRepository::findAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace TemplateNamespace\Entity\Repositories;
4
5
use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\EntityInterface;
6
use TemplateNamespace\Entity\Interfaces\TemplateEntityInterface;
7
use TemplateNamespace\Entity\Repositories\AbstractEntityRepository as ProjectAbstractEntityRepository;
8
9
10
class TemplateEntityRepository extends ProjectAbstractEntityRepository
11
{
12
    public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?TemplateEntityInterface
13
    {
14
        $result = parent::find($id, $lockMode, $lockVersion);
15
        if ($result === null || $result instanceof TemplateEntityInterface) {
16
            return $result;
17
        }
18
19
        throw new \RuntimeException('Unknown entity type of ' . \get_class($result) . ' returned');
20
    }
21
22
    public function get($id, ?int $lockMode = null, ?int $lockVersion = null): TemplateEntityInterface
23
    {
24
        $result = parent::get($id, $lockMode, $lockVersion);
25
        if ($result instanceof TemplateEntityInterface) {
26
            return $result;
27
        }
28
        throw new \RuntimeException('Unknown entity type of ' . \get_class($result) . ' returned');
29
    }
30
31
    public function getOneBy(array $criteria, ?array $orderBy = null): TemplateEntityInterface
32
    {
33
        $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...
34
        if ($result === null) {
0 ignored issues
show
introduced by
The condition $result === null is always true.
Loading history...
35
            throw new \RuntimeException('Could not find the entity');
36
        }
37
38
        return $result;
39
    }
40
41
    public function findOneBy(array $criteria, ?array $orderBy = null): ?TemplateEntityInterface
42
    {
43
        $result = parent::findOneBy($criteria, $orderBy);
44
        if ($result === null || $result instanceof TemplateEntityInterface) {
45
            return $result;
46
        }
47
48
        throw new \RuntimeException('Unknown entity type of ' . \get_class($result) . ' returned');
49
    }
50
51
    /**
52
     * @param array      $criteria
53
     * @param array|null $orderBy
54
     * @param int|null   $limit
55
     * @param int|null   $offset
56
     *
57
     * @return TemplateEntityInterface[]|array|EntityInterface[]
58
     */
59
    public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
60
    {
61
        return parent::findBy($criteria, $orderBy, $limit, $offset);
62
    }
63
64
    /**
65
     * @return TemplateEntityInterface[]|array|EntityInterface[]
66
     */
67
    public function findAll(): array
68
    {
69
        return parent::findAll();
70
    }
71
72
73
74
75
    public function getRandomOneBy(array $criteria): ?TemplateEntityInterface
76
    {
77
        $result = parent::getRandomOneBy($criteria);
78
        if ($result === null || $result instanceof TemplateEntityInterface) {
79
            return $result;
80
        }
81
        throw new \RuntimeException('Unknown entity type of ' . \get_class($result) . ' returned');
82
    }
83
84
    /**
85
     * @param array $criteria
86
     * @param int   $numToGet
87
     *
88
     * @return TemplateEntityInterface[]|array|EntityInterface[]
89
     */
90
    public function getRandomBy(array $criteria, int $numToGet = 1): array
91
    {
92
        return parent::getRandomBy($criteria, $numToGet);
93
    }
94
95
    /**
96
     * @param EntityInterface|TemplateEntityInterface $entity
97
     *
98
     * @return TemplateEntityInterface
99
     */
100
    public function initialiseEntity(EntityInterface $entity): TemplateEntityInterface
101
    {
102
        return parent::initialiseEntity($entity);
0 ignored issues
show
Bug Best Practice introduced by
The expression return parent::initialiseEntity($entity) returns the type EdmondsCommerce\Doctrine...erfaces\EntityInterface which includes types incompatible with the type-hinted return TemplateNamespace\Entity...TemplateEntityInterface.
Loading history...
103
    }
104
105
106
}
107