Skip to content

Commit 3f24ac6

Browse files
authored
fix: add #[\ReturnTypeWillChange] when needed (#697)
1 parent b717194 commit 3f24ac6

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

src/Iterators/AbstractAlgoliaIterator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function __construct($indexName, ApiWrapper $api, $requestOptions = [])
6868
*
6969
* @return array
7070
*/
71+
#[\ReturnTypeWillChange]
7172
public function current()
7273
{
7374
$hit = $this->response['hits'][$this->batchKey];
@@ -78,6 +79,7 @@ public function current()
7879
/**
7980
* Move forward to next element.
8081
*/
82+
#[\ReturnTypeWillChange]
8183
public function next()
8284
{
8385
$this->key++;
@@ -94,6 +96,7 @@ public function next()
9496
*
9597
* @return int
9698
*/
99+
#[\ReturnTypeWillChange]
97100
public function key()
98101
{
99102
return $this->key;
@@ -107,6 +110,7 @@ public function key()
107110
* @return bool the return value will be casted to boolean and then evaluated.
108111
* Returns true on success or false on failure
109112
*/
113+
#[\ReturnTypeWillChange]
110114
public function valid()
111115
{
112116
return isset($this->response['hits'][$this->batchKey]);
@@ -115,6 +119,7 @@ public function valid()
115119
/**
116120
* Rewind the Iterator to the first element.
117121
*/
122+
#[\ReturnTypeWillChange]
118123
public function rewind()
119124
{
120125
if (0 !== $this->key) {

src/Response/AbstractResponse.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function getBody()
2222
/**
2323
* {@inheritdoc}
2424
*/
25+
#[\ReturnTypeWillChange]
2526
public function offsetExists($offset)
2627
{
2728
return isset($this->apiResponse[$offset]);
@@ -30,6 +31,7 @@ public function offsetExists($offset)
3031
/**
3132
* {@inheritdoc}
3233
*/
34+
#[\ReturnTypeWillChange]
3335
public function offsetGet($offset)
3436
{
3537
return $this->apiResponse[$offset];
@@ -38,6 +40,7 @@ public function offsetGet($offset)
3840
/**
3941
* {@inheritdoc}
4042
*/
43+
#[\ReturnTypeWillChange]
4144
public function offsetSet($offset, $value)
4245
{
4346
$this->apiResponse[$offset] = $value;
@@ -46,6 +49,7 @@ public function offsetSet($offset, $value)
4649
/**
4750
* {@inheritdoc}
4851
*/
52+
#[\ReturnTypeWillChange]
4953
public function offsetUnset($offset)
5054
{
5155
unset($this->apiResponse[$offset]);

src/Response/BatchIndexingResponse.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,37 @@ public function wait($requestOptions = [])
4141
*
4242
* @return number of response from the API (number of batches sent)
4343
*/
44+
#[\ReturnTypeWillChange]
4445
public function count()
4546
{
4647
return count($this->apiResponse);
4748
}
4849

50+
#[\ReturnTypeWillChange]
4951
public function current()
5052
{
5153
return $this->apiResponse[$this->key];
5254
}
5355

56+
#[\ReturnTypeWillChange]
5457
public function next()
5558
{
5659
$this->key++;
5760
}
5861

62+
#[\ReturnTypeWillChange]
5963
public function key()
6064
{
6165
return $this->key;
6266
}
6367

68+
#[\ReturnTypeWillChange]
6469
public function valid()
6570
{
6671
return isset($this->apiResponse[$this->key]);
6772
}
6873

74+
#[\ReturnTypeWillChange]
6975
public function rewind()
7076
{
7177
$this->key = 0;

src/Response/MultiResponse.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,37 @@ public function wait($requestOptions = [])
2020
return $this;
2121
}
2222

23+
#[\ReturnTypeWillChange]
2324
public function count()
2425
{
2526
return count($this->apiResponse);
2627
}
2728

29+
#[\ReturnTypeWillChange]
2830
public function current()
2931
{
3032
return $this->apiResponse[$this->key];
3133
}
3234

35+
#[\ReturnTypeWillChange]
3336
public function next()
3437
{
3538
$this->key++;
3639
}
3740

41+
#[\ReturnTypeWillChange]
3842
public function key()
3943
{
4044
return $this->key;
4145
}
4246

47+
#[\ReturnTypeWillChange]
4348
public function valid()
4449
{
4550
return isset($this->apiResponse[$this->key]);
4651
}
4752

53+
#[\ReturnTypeWillChange]
4854
public function rewind()
4955
{
5056
$this->key = 0;

0 commit comments

Comments
 (0)