Issues (104)

src/Orm/UserRepo.php (5 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\Orm;
6
7
use AbterPhp\Admin\Domain\Entities\User as Entity;
8
use AbterPhp\Admin\Orm\DataMappers\UserSqlDataMapper; // @phan-suppress-current-line PhanUnreferencedUseNormal
9
use AbterPhp\Framework\Orm\IGridRepo;
10
use Opulence\Orm\OrmException;
11
use Opulence\Orm\Repositories\Repository;
12
13
class UserRepo extends Repository implements IGridRepo
14
{
15
    /**
16
     * @param int      $limitFrom
17
     * @param int      $pageSize
18
     * @param string[] $orders
19
     * @param array    $conditions
20
     * @param array    $params
21
     *
22
     * @return Entity[]
23
     * @throws \Opulence\Orm\OrmException
24
     */
25
    public function getPage(int $limitFrom, int $pageSize, array $orders, array $conditions, array $params): array
26
    {
27
        /** @see UserSqlDataMapper::getPage() */
28
        return $this->getFromDataMapper('getPage', [$limitFrom, $pageSize, $orders, $conditions, $params]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat... $conditions, $params)) could return the type object which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
29
    }
30
31
    /**
32
     * @param string $clientId
33
     *
34
     * @return Entity|null
35
     * @throws OrmException
36
     */
37
    public function getByClientId(string $clientId): ?Entity
38
    {
39
        /** @see UserSqlDataMapper::getByClientId() */
40
        return $this->getFromDataMapper('getByClientId', [$clientId]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...tId', array($clientId)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Admin\Domain\Entities\User|null. Consider adding an additional type-check to rule them out.
Loading history...
41
    }
42
43
    /**
44
     * @param string $username
45
     *
46
     * @return Entity|null
47
     * @throws OrmException
48
     */
49
    public function getByUsername(string $username): ?Entity
50
    {
51
        /** @see UserSqlDataMapper::getByUsername() */
52
        return $this->getFromDataMapper('getByUsername', [$username]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...ame', array($username)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Admin\Domain\Entities\User|null. Consider adding an additional type-check to rule them out.
Loading history...
53
    }
54
55
    /**
56
     * @param string $email
57
     *
58
     * @return Entity|null
59
     * @throws OrmException
60
     */
61
    public function getByEmail(string $email): ?Entity
62
    {
63
        /** @see UserSqlDataMapper::getByEmail() */
64
        return $this->getFromDataMapper('getByEmail', [$email]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...yEmail', array($email)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Admin\Domain\Entities\User|null. Consider adding an additional type-check to rule them out.
Loading history...
65
    }
66
67
    /**
68
     * @param string $identifier
69
     *
70
     * @return Entity|null
71
     * @throws OrmException
72
     */
73
    public function find(string $identifier): ?Entity
74
    {
75
        /** @see UserSqlDataMapper::find() */
76
        return $this->getFromDataMapper('find', [$identifier]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...d', array($identifier)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Admin\Domain\Entities\User|null. Consider adding an additional type-check to rule them out.
Loading history...
77
    }
78
}
79