Issues (36)

src/QueryBuilder/IsEnabledQueryBuilder.php (1 issue)

Labels
Severity
1
<?php
2
3
/*
4
 * This file was created by developers working at BitBag
5
 * Do you need more information about us and what we do? Visit our https://bitbag.io website!
6
 * We are hiring developers from all over the world. Join us and start your new, exciting adventure and become part of us: https://bitbag.io/career
7
*/
8
9
declare(strict_types=1);
10
11
namespace BitBag\SyliusElasticsearchPlugin\QueryBuilder;
12
13
use Elastica\Query\AbstractQuery;
14
use Elastica\Query\Term;
15
16
final class IsEnabledQueryBuilder implements QueryBuilderInterface
17
{
18
    /** @var string */
19
    private $enabledProperty;
20
21
    public function __construct(string $enabledProperty)
22
    {
23
        $this->enabledProperty = $enabledProperty;
24
    }
25
26
    public function buildQuery(array $data): ?AbstractQuery
27
    {
28
        $enabledQuery = new Term();
29
        $enabledQuery->setTerm($this->enabledProperty, true);
0 ignored issues
show
true of type true is incompatible with the type array|string expected by parameter $value of Elastica\Query\Term::setTerm(). ( Ignorable by Annotation )

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

29
        $enabledQuery->setTerm($this->enabledProperty, /** @scrutinizer ignore-type */ true);
Loading history...
30
31
        return $enabledQuery;
32
    }
33
}
34