Skip to content

Commit 69b1490

Browse files
committed
Range can be all types
1 parent 1fe3358 commit 69b1490

File tree

2 files changed

+20
-32
lines changed

2 files changed

+20
-32
lines changed

src/Aggregation/RangeValue.php

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,30 @@
66
class RangeValue implements \Spameri\ElasticQuery\Entity\EntityInterface
77
{
88

9-
/**
10-
* @var string
11-
*/
12-
private $key;
9+
private string $key;
1310

1411
/**
15-
* @var int
12+
* @var int|float|string|\DateTimeInterface|null
1613
*/
1714
private $from;
1815

1916
/**
20-
* @var int
17+
* @var int|float|string|\DateTimeInterface|null
2118
*/
2219
private $to;
2320

24-
/**
25-
* @var bool
26-
*/
27-
private $fromEqual;
21+
private bool $fromEqual;
22+
23+
private bool $toEqual;
2824

2925
/**
30-
* @var bool
26+
* @param int|float|string|\DateTimeInterface|null $from
27+
* @param int|float|string|\DateTimeInterface|null $to
3128
*/
32-
private $toEqual;
33-
34-
3529
public function __construct(
3630
string $key,
37-
int $from,
38-
int $to,
31+
$from,
32+
$to,
3933
bool $fromEqual = TRUE,
4034
bool $toEqual = TRUE
4135
)

src/Query/Range.php

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,30 @@
99
class Range implements LeafQueryInterface
1010
{
1111

12-
/**
13-
* @var string
14-
*/
15-
private $field;
12+
private string $field;
1613

1714
/**
18-
* @var int|float|\DateTimeInterface|null
15+
* @var int|float|string|\DateTimeInterface|null
1916
*/
2017
private $gte;
2118

2219
/**
23-
* @var int|float|\DateTimeInterface|null
20+
* @var int|float|string|\DateTimeInterface|null
2421
*/
2522
private $lte;
2623

27-
/**
28-
* @var float
29-
*/
30-
private $boost;
24+
private float $boost;
3125

3226

3327
/**
34-
* @phpstan-param int|float|\DateTimeInterface|null $gte
35-
* @phpstan-param int|float|\DateTimeInterface|null $lte
28+
* @param int|float|string|\DateTimeInterface|null $gte
29+
* @param int|float|string|\DateTimeInterface|null $lte
3630
*/
3731
public function __construct(
38-
string $field
39-
, $gte = NULL
40-
, $lte = NULL
41-
, float $boost = 1.0
32+
string $field,
33+
$gte = NULL,
34+
$lte = NULL,
35+
float $boost = 1.0
4236
)
4337
{
4438
if ($gte === NULL && $lte === NULL) {

0 commit comments

Comments
 (0)