It seems like array_combine($sortableFields, $sortableFields) can also be of type false; however, parameter $sortableFields of Stratadox\Sorting\OrderByParser::__construct() does only seem to accept array, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
29
return new self(/** @scrutinizer ignore-type */ array_combine($sortableFields, $sortableFields));
Loading history...
30
}
31
32
public function parse(Sorting $sorting): string
33
{
34
if (!$sorting->isRequired()) {
35
return '';
36
}
37
$orderBy = [];
38
while ($sorting->isRequired()) {
39
$orderBy[] = $this->parseSingle($sorting);
40
$sorting = $sorting->next();
41
}
42
return sprintf('ORDER BY %s', implode(', ', $orderBy));
43
}
44
45
private function parseSingle(Sorting $sorting): string
46
{
47
if (!array_key_exists($sorting->field(), $this->sortableFields)) {