Skip to content

Commit 5ec2c7e

Browse files
authored
Fix #332: Added [\ReturnTypeWillChange] attribute for BatchQueryResult methods to be compatible with Iterator interface
1 parent 483baae commit 5ec2c7e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

BatchQueryResult.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace yii\elasticsearch;
99

10+
use ReturnTypeWillChange;
1011
use yii\base\BaseObject;
1112

1213
/**
@@ -111,6 +112,7 @@ public function reset()
111112
* Resets the iterator to the initial state.
112113
* This method is required by the interface [[\Iterator]].
113114
*/
115+
#[ReturnTypeWillChange]
114116
public function rewind()
115117
{
116118
$this->reset();
@@ -121,6 +123,7 @@ public function rewind()
121123
* Moves the internal pointer to the next dataset.
122124
* This method is required by the interface [[\Iterator]].
123125
*/
126+
#[ReturnTypeWillChange]
124127
public function next()
125128
{
126129
if ($this->_batch === null || !$this->each || $this->each && next($this->_batch) === false) {
@@ -183,6 +186,7 @@ protected function fetchData()
183186
* This method is required by the interface [[\Iterator]].
184187
* @return int the index of the current row.
185188
*/
189+
#[ReturnTypeWillChange]
186190
public function key()
187191
{
188192
return $this->_key;
@@ -193,6 +197,7 @@ public function key()
193197
* This method is required by the interface [[\Iterator]].
194198
* @return mixed the current dataset.
195199
*/
200+
#[ReturnTypeWillChange]
196201
public function current()
197202
{
198203
return $this->_value;
@@ -203,6 +208,7 @@ public function current()
203208
* This method is required by the interface [[\Iterator]].
204209
* @return bool whether there is a valid dataset at the current position.
205210
*/
211+
#[ReturnTypeWillChange]
206212
public function valid()
207213
{
208214
return !empty($this->_batch);

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Yii Framework 2 Elasticsearch extension Change Log
55
-----------------------
66
- Enh #329: Added `curlOptions` attribute for advanced configuration of curl session (yuniorsk)
77
- Bug #330: Fix `curlOptions` merging (yuniorsk)
8+
- Bug #332: Added `[\ReturnTypeWillChange]` attribute for BatchQueryResult methods to be compatible with Iterator interface (warton)
89

910
2.1.3 August 07, 2022
1011
-----------------------

0 commit comments

Comments
 (0)