Passed
Pull Request — master (#65)
by Zing
05:54
created

src/Sorts/SortField.php (1 issue)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zing\QueryBuilder\Sorts;
6
7
use Illuminate\Database\Eloquent\Builder;
8
use Zing\QueryBuilder\Contracts\Sort;
9
10
class SortField implements Sort
11
{
12 3
    public function apply(Builder $query, bool $descending, string $property): Builder
13
    {
14 3
        return $query->orderBy($property, $descending ? 'desc' : 'asc');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $query->orderBy($...nding ? 'desc' : 'asc') could return the type Illuminate\Database\Query\Builder which is incompatible with the type-hinted return Illuminate\Database\Eloquent\Builder. Consider adding an additional type-check to rule them out.
Loading history...
15
    }
16
}
17