Issues (44)

app/Services/User/UserSolutions.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace App\Services\User;
4
5
use App\Entities\User;
6
use App\Repositories\Criteria\Distinct;
7
use App\Repositories\Criteria\Where;
8
use App\Repositories\SolutionRepository;
9
use App\Status;
10
11
class UserSolutions
12
{
13
    public function getResolvedProblems(User $user)
14
    {
15
        /** @var SolutionRepository $repository */
16
        $repository = app(SolutionRepository::class);
17
        $repository->pushCriteria(new Where('user_id', $user->id));
18
        $repository->pushCriteria(new Where('result', Status::ACCEPT));
19
        $repository->pushCriteria(new Distinct('problem_id'));
20
21
        return $repository->all('problem_id')->map(function ($item) {
0 ignored issues
show
'problem_id' of type string is incompatible with the type array expected by parameter $columns of Czim\Repository\BaseRepository::all(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

21
        return $repository->all(/** @scrutinizer ignore-type */ 'problem_id')->map(function ($item) {
Loading history...
22
            return $item->problem_id;
23
        });
24
    }
25
}
26