Completed
Pull Request — master (#148)
by Simonas
02:51
created

FiltersAggregation::addFilter()   B

Complexity

Conditions 5
Paths 3

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 12
rs 8.8571
cc 5
eloc 8
nc 3
nop 2
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\ElasticsearchDSL\Aggregation;
13
14
use ONGR\ElasticsearchDSL\BuilderInterface;
15
use ONGR\ElasticsearchDSL\Aggregation\Bucketing\FiltersAggregation as Base;
16
17
/**
18
 * Class representing filters aggregation.
19
 *
20
 * @deprecated Aggregations was moved to it's type namespace. Add `Metric` or `Bucketing` after `Aggregation`.
21
 *     This class will be removed in 3.0.
22
 */
23
class FiltersAggregation extends Base
24
{
25
    public function __construct($name, BuilderInterface $filter)
26
    {
27
        parent::__construct($name, $filter);
0 ignored issues
show
Documentation introduced by
$filter is of type object<ONGR\ElasticsearchDSL\BuilderInterface>, but the function expects a array<integer,object<ONG...hDSL\BuilderInterface>>.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
28
29
        trigger_error(
30
            'This aggregation is moved to `Bucketing` namespace. Use the new namespace instead.' .
31
            ' It will be removed in 3.0',
32
            E_USER_DEPRECATED
33
        );
34
    }
35
}
36