Skip to content

Commit 8632da7

Browse files
committed
PHPCS - promoted properties
1 parent b3ca2db commit 8632da7

File tree

83 files changed

+391
-635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+391
-635
lines changed

ruleset.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<!-- PHP -->
6262
<rule ref="Generic.PHP.DeprecatedFunctions"/>
6363
<rule ref="Generic.PHP.ForbiddenFunctions"/>
64-
<rule ref="Generic.PHP.UpperCaseConstant"/>
64+
<rule ref="Generic.PHP.LowerCaseConstant"/>
6565
<rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking"/>
6666

6767
<!-- NewLines -->

src/Aggregation/AggregationCollection.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@
88
class AggregationCollection implements LeafAggregationInterface
99
{
1010

11-
private \Spameri\ElasticQuery\Filter\FilterCollection $filter;
12-
1311
/**
1412
* @var array<\Spameri\ElasticQuery\Aggregation\LeafAggregationCollection>
1513
*/
1614
private array $aggregations;
1715

1816

1917
public function __construct(
20-
\Spameri\ElasticQuery\Filter\FilterCollection|null $filter = NULL,
21-
\Spameri\ElasticQuery\Aggregation\LeafAggregationCollection ... $aggregations,
18+
private \Spameri\ElasticQuery\Filter\FilterCollection|null $filter = null,
19+
\Spameri\ElasticQuery\Aggregation\LeafAggregationCollection ...$aggregations,
2220
)
2321
{
2422
if ( ! $filter) {

src/Aggregation/Histogram.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function toArray(): array
2929
{
3030
return [
3131
'histogram' => [
32-
'field' => $this->field,
32+
'field' => $this->field,
3333
'interval' => $this->interval,
3434
],
3535
];

src/Aggregation/LeafAggregationCollection.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
class LeafAggregationCollection implements LeafAggregationInterface, \IteratorAggregate
99
{
1010

11-
private \Spameri\ElasticQuery\Filter\FilterCollection $filter;
12-
1311
/**
1412
* @var array<\Spameri\ElasticQuery\Aggregation\LeafAggregationInterface>
1513
*/
@@ -18,8 +16,8 @@ class LeafAggregationCollection implements LeafAggregationInterface, \IteratorAg
1816

1917
public function __construct(
2018
private string $name,
21-
\Spameri\ElasticQuery\Filter\FilterCollection|null $filter,
22-
\Spameri\ElasticQuery\Aggregation\LeafAggregationInterface ... $aggregations,
19+
private \Spameri\ElasticQuery\Filter\FilterCollection|null $filter,
20+
\Spameri\ElasticQuery\Aggregation\LeafAggregationInterface ...$aggregations,
2321
)
2422
{
2523
if ( ! $filter) {

src/Aggregation/Min.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class Min implements \Spameri\ElasticQuery\Aggregation\LeafAggregationInterface
99

1010
public function __construct(
1111
private string $field,
12-
) {
12+
)
13+
{
1314
}
1415

1516

src/Aggregation/Nested.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class Nested implements \Spameri\ElasticQuery\Aggregation\LeafAggregationInterfa
99

1010
public function __construct(
1111
private string $path,
12-
) {
12+
)
13+
{
1314
}
1415

1516

src/Aggregation/Range.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class Range implements LeafAggregationInterface
1616

1717
public function __construct(
1818
private string $field,
19-
private bool $keyed = FALSE,
20-
\Spameri\ElasticQuery\Aggregation\RangeValueCollection $rangeValueCollection = NULL,
19+
private bool $keyed = false,
20+
\Spameri\ElasticQuery\Aggregation\RangeValueCollection $rangeValueCollection = null,
2121
)
2222
{
2323
$this->ranges = $rangeValueCollection ?: new \Spameri\ElasticQuery\Aggregation\RangeValueCollection();
@@ -36,8 +36,8 @@ public function toArray(): array
3636
'field' => $this->field,
3737
];
3838

39-
if ($this->keyed === TRUE) {
40-
$array['keyed'] = TRUE;
39+
if ($this->keyed === true) {
40+
$array['keyed'] = true;
4141
}
4242

4343
foreach ($this->ranges as $range) {

src/Aggregation/RangeValue.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,12 @@
88
class RangeValue implements \Spameri\ElasticQuery\Entity\EntityInterface
99
{
1010

11-
/**
12-
* @param int|float|string|\DateTimeInterface|null $from
13-
* @param int|float|string|\DateTimeInterface|null $to
14-
*/
1511
public function __construct(
1612
private string $key,
17-
private $from,
18-
private $to,
19-
private bool $fromEqual = TRUE,
20-
private bool $toEqual = TRUE,
13+
private int|float|string|\DateTimeInterface|null $from,
14+
private int|float|string|\DateTimeInterface|null $to,
15+
private bool $fromEqual = true,
16+
private bool $toEqual = true,
2117
)
2218
{
2319
}
@@ -42,7 +38,7 @@ public function toArray(): array
4238
}
4339

4440
return [
45-
'key' => $this->key,
41+
'key' => $this->key,
4642
'from' => $from,
4743
'to' => $to,
4844
];

src/Aggregation/RangeValueCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class RangeValueCollection implements \IteratorAggregate
1515

1616

1717
public function __construct(
18-
RangeValue ... $collection,
18+
RangeValue ...$collection,
1919
)
2020
{
2121
$this->collection = $collection;

src/Aggregation/Term.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,18 @@
1111
class Term implements LeafAggregationInterface
1212
{
1313

14-
private int|null $missing;
15-
1614
private \Spameri\ElasticQuery\Aggregation\Terms\OrderCollection $order;
1715

1816
public function __construct(
1917
private string $field,
2018
private int $size = 0,
21-
int $missing = NULL,
22-
\Spameri\ElasticQuery\Aggregation\Terms\OrderCollection|null $order = NULL,
23-
private string|null $include = NULL,
24-
private string|null $exclude = NULL,
25-
private string|null $key = NULL,
19+
private int|null $missing = null,
20+
\Spameri\ElasticQuery\Aggregation\Terms\OrderCollection|null $order = null,
21+
private string|null $include = null,
22+
private string|null $exclude = null,
23+
private string|null $key = null,
2624
)
2725
{
28-
$this->missing = $missing;
2926
$this->order = $order ?? new \Spameri\ElasticQuery\Aggregation\Terms\OrderCollection();
3027
}
3128

@@ -43,22 +40,22 @@ public function toArray(): array
4340
];
4441

4542
if ($this->size > 0) {
46-
$array['size'] = $this->size;
43+
$array['size'] = $this->size;
4744
}
4845

49-
if ($this->missing !== NULL) {
46+
if ($this->missing !== null) {
5047
$array['missing'] = $this->missing;
5148
}
5249

5350
if (\count($this->order)) {
5451
$array['order'] = $this->order->toArray();
5552
}
5653

57-
if ($this->include !== NULL) {
54+
if ($this->include !== null) {
5855
$array['include'] = $this->include;
5956
}
6057

61-
if ($this->exclude !== NULL) {
58+
if ($this->exclude !== null) {
6259
$array['exclude'] = $this->exclude;
6360
}
6461

0 commit comments

Comments
 (0)