Issues (104)

src/Orm/AdminResourceRepo.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Admin\Orm;
6
7
use AbterPhp\Admin\Domain\Entities\AdminResource as Entity;
8
use Opulence\Orm\OrmException;
9
use Opulence\Orm\Repositories\Repository;
10
11
class AdminResourceRepo extends Repository
12
{
13
    /**
14
     * @param string $identifier
15
     *
16
     * @return Entity|null
17
     * @throws OrmException
18
     */
19
    public function getByIdentifier(string $identifier): ?Entity
20
    {
21
        /** @see AdminResourceSqlDataMapper::getByIdentifier() */
22
        return $this->getFromDataMapper('getByIdentifier', [$identifier]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...r', array($identifier)) could return the type array<mixed,object> which is incompatible with the type-hinted return AbterPhp\Admin\Domain\Entities\AdminResource|null. Consider adding an additional type-check to rule them out.
Loading history...
23
    }
24
    /**
25
     * @param string $userId
26
     *
27
     * @return Entity[]
28
     * @throws OrmException
29
     */
30
    public function getByUserId(string $userId): array
31
    {
32
        /** @see AdminResourceSqlDataMapper::getByUserId() */
33
        return $this->getFromDataMapper('getByUserId', [$userId]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getFromDat...serId', array($userId)) 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...
34
    }
35
}
36