Conditions | 3 |
Paths | 2 |
Total Lines | 22 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function findByCriteria(Criteria $criteria): PaginatorAdapterInterface |
||
29 | { |
||
30 | $boolFilter = new BoolQuery(); |
||
31 | |||
32 | if (null !== $criteria->getTerm() && '' !== $criteria->getTerm()) { |
||
33 | $boolQuery = new BoolQuery(); |
||
34 | $term = $criteria->getTerm(); |
||
35 | |||
36 | $boolQuery->addShould(new Query\MatchPhrase('name', $term)); |
||
37 | $boolFilter->addMust($boolQuery); |
||
38 | } else { |
||
39 | $boolFilter->addMust(new MatchAll()); |
||
40 | } |
||
41 | |||
42 | $query = Query::create($boolFilter) |
||
43 | ->addSort([ |
||
44 | '_score' => 'desc', |
||
45 | $criteria->getOrder()->getField() => $criteria->getOrder()->getDirection(), |
||
46 | ]); |
||
47 | |||
48 | return $this->createPaginatorAdapter($query); |
||
|
|||
49 | } |
||
50 | } |
||
51 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: