Issues (92)

src/target/TargetRepository.php (1 issue)

1
<?php
2
/**
3
 * API for Billing
4
 *
5
 * @link      https://github.com/hiqdev/billing-hiapi
6
 * @package   billing-hiapi
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\billing\hiapi\target;
12
13
use hiqdev\php\billing\target\Target;
14
use hiqdev\yii\DataMapper\query\Specification;
15
16
/**
17
 * Class TargetRepository.
18
 *
19
 * @author Dmytro Naumenko <[email protected]>
20
 */
21
class TargetRepository extends \hiqdev\yii\DataMapper\repositories\BaseRepository
22
{
23
    public $queryClass = TargetQuery::class;
24
25
    public function findOneById($id): ?Target
26
    {
27
        return $this->findOne((new Specification())->andWhere(['id' => $id]));
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->findOne(ne...re(array('id' => $id))) could return the type false which is incompatible with the type-hinted return hiqdev\php\billing\target\Target|null. Consider adding an additional type-check to rule them out.
Loading history...
28
    }
29
}
30