Skip to content

Commit d13229f

Browse files
authored
Merge pull request #65 from MacFJA/php8-deprecated
Fix deprecation warning with PHP 8.1+
2 parents 837bf52 + be24590 commit d13229f

File tree

13 files changed

+36
-76
lines changed

13 files changed

+36
-76
lines changed

src/Query/Builder/QueryElementDecorator.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@
2121

2222
namespace MacFJA\RediSearch\Query\Builder;
2323

24-
interface QueryElementDecorator extends QueryElement
25-
{
26-
}
24+
interface QueryElementDecorator extends QueryElement {}

src/Query/Builder/QueryElementVector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
class QueryElementVector implements QueryElementDecorator
3434
{
3535
private const PARAMETERS = [
36-
'EF_RUNTIME' => 'int',
36+
'EF_RUNTIME' => 'integer',
3737
];
3838

3939
/** @var QueryElement */

src/Redis/Client/PhpredisClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public function executeRaw(...$args)
8585
if (count($args) < 1) {
8686
return null;
8787
}
88+
8889
// @phpstan-ignore-next-line
8990
return $this->redis->rawCommand(...$args);
9091
}

src/Redis/Command/AggregateCommand/LimitOption.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@
2121

2222
namespace MacFJA\RediSearch\Redis\Command\AggregateCommand;
2323

24-
class LimitOption extends \MacFJA\RediSearch\Redis\Command\SearchCommand\LimitOption
25-
{
26-
}
24+
class LimitOption extends \MacFJA\RediSearch\Redis\Command\SearchCommand\LimitOption {}

src/Redis/Command/CreateCommand/VectorFieldOption.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ public function addAttribute(string $type, int $dimension, string $distanceMetri
121121
+ (is_int($blockSize) ? 2 : 0)
122122
+ (is_int($maxEdge) ? 2 : 0)
123123
+ (is_int($efConstruction) ? 2 : 0)
124-
+ (is_int($efRuntime) ? 2 : 0)
125-
;
124+
+ (is_int($efRuntime) ? 2 : 0);
126125

127126
/** @var int $count */
128127
$count = $this->getDataOfOption('count') ?? 0;

src/Redis/Command/Option/DecoratedOptionTrait.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public function getVersionConstraint(): string
6161
return $this->decorated->getVersionConstraint();
6262
}
6363

64+
/**
65+
* @return array<float|int|string>
66+
*/
6467
public function render(?string $version = null): array
6568
{
6669
return $this->decorated->render($version);

src/Redis/Command/Search.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,7 @@ public function parseResponse($data)
360360
+ (true === $useScores ? 1 : 0)
361361
+ (true === $usePayloads ? 1 : 0)
362362
+ (true === $useSortKeys ? 1 : 0)
363-
- (true === $noContent ? 1 : 0)
364-
;
363+
- (true === $noContent ? 1 : 0);
365364

366365
$documents = array_chunk($data, $chunkSize);
367366

src/Redis/Response.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@
2121

2222
namespace MacFJA\RediSearch\Redis;
2323

24-
interface Response
25-
{
26-
}
24+
interface Response {}

src/Redis/Response/AggregateResponseItem.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public function getValue(string $fieldName, $default = null)
6565
__METHOD__,
6666
__CLASS__
6767
), E_USER_DEPRECATED);
68+
6869
// @phpstan-ignore-next-line
6970
return $this->getFieldValue($fieldName, $default);
7071
}

src/Redis/Response/PaginatedResponse.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function __construct(PaginatedCommand $command, int $totalCount, array $i
6666
/**
6767
* @return array<ResponseItem>
6868
*/
69-
public function current()
69+
public function current(): array
7070
{
7171
if ($this->requestedOffset === ($this->lastCommand->getOffset() ?? 0) && ($this->requestedSize === $this->getPageSize())) {
7272
$this->requestedOffset = null;
@@ -101,7 +101,7 @@ public function getPageCount(): int
101101
return (int) ceil($this->totalCount / $this->getPageSize());
102102
}
103103

104-
public function key()
104+
public function key(): int
105105
{
106106
if (0 === $this->getPageSize()) {
107107
return 0;
@@ -110,7 +110,7 @@ public function key()
110110
return (int) floor(($this->lastCommand->getOffset() ?? $this->requestedOffset ?? 0) / $this->getPageSize());
111111
}
112112

113-
public function valid()
113+
public function valid(): bool
114114
{
115115
return (
116116
null === $this->requestedOffset
@@ -133,7 +133,7 @@ public function getTotalCount(): int
133133
return $this->totalCount;
134134
}
135135

136-
public function count()
136+
public function count(): int
137137
{
138138
return $this->getPageCount();
139139
}

0 commit comments

Comments
 (0)