Passed
Pull Request — master (#191)
by
unknown
10:08
created

HasAuthorizedGroup   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A buildQuery() 0 6 1
1
<?php
2
/*
3
4
This file was created by developers working at BitBag
5
6
Do you need more information about us and what we do? Visit our   website!
7
8
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
9
*/
10
declare(strict_types=1);
11
12
namespace BitBag\SyliusElasticsearchPlugin\QueryBuilder;
13
14
use Elastica\Query\AbstractQuery;
15
use Elastica\Query\Terms;
16
17
final class HasAuthorizedGroup implements QueryBuilderInterface
18
{
19
20
    public function buildQuery(array $data): ?AbstractQuery
21
    {
22
        $authorizedGroupQuery = new Terms();
23
        $authorizedGroupQuery->setTerms($authorizedGroupQuery);
0 ignored issues
show
Bug introduced by
The call to Elastica\Query\Terms::setTerms() has too few arguments starting with terms. ( Ignorable by Annotation )

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

23
        $authorizedGroupQuery->/** @scrutinizer ignore-call */ 
24
                               setTerms($authorizedGroupQuery);

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
Bug introduced by
$authorizedGroupQuery of type Elastica\Query\Terms is incompatible with the type string expected by parameter $key of Elastica\Query\Terms::setTerms(). ( Ignorable by Annotation )

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

23
        $authorizedGroupQuery->setTerms(/** @scrutinizer ignore-type */ $authorizedGroupQuery);
Loading history...
24
25
        return $authorizedGroupQuery;
26
    }
27
}
28