Skip to content

Commit 3d2d852

Browse files
committed
Fixed some PHP deprecations for PHP 8
1 parent 5ecee56 commit 3d2d852

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

composer.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
}
4949
},
5050
"config": {
51-
"sort-packages": true
51+
"sort-packages": true,
52+
"allow-plugins": {
53+
"php-http/discovery": true
54+
}
5255
},
5356
"scripts": {
5457
"phpcs": [

src/Elasticsearch/Helper/Iterators/SearchHitIterator.php

+6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public function __construct(SearchResponseIterator $search_responses)
6969
* @return void
7070
* @see Iterator::rewind()
7171
*/
72+
#[\ReturnTypeWillChange]
7273
public function rewind()
7374
{
7475
$this->current_key = 0;
@@ -96,6 +97,7 @@ public function rewind()
9697
* @return void
9798
* @see Iterator::next()
9899
*/
100+
#[\ReturnTypeWillChange]
99101
public function next()
100102
{
101103
$this->current_key++;
@@ -115,6 +117,7 @@ public function next()
115117
* @return bool
116118
* @see Iterator::valid()
117119
*/
120+
#[\ReturnTypeWillChange]
118121
public function valid()
119122
{
120123
return is_array($this->current_hit_data);
@@ -126,6 +129,7 @@ public function valid()
126129
* @return array
127130
* @see Iterator::current()
128131
*/
132+
#[\ReturnTypeWillChange]
129133
public function current()
130134
{
131135
return $this->current_hit_data;
@@ -137,6 +141,7 @@ public function current()
137141
* @return int
138142
* @see Iterator::key()
139143
*/
144+
#[\ReturnTypeWillChange]
140145
public function key()
141146
{
142147
return $this->current_key;
@@ -161,6 +166,7 @@ private function readPageData()
161166
/**
162167
* {@inheritDoc}
163168
*/
169+
#[\ReturnTypeWillChange]
164170
public function count()
165171
{
166172
if ($this->count === null) {

src/Elasticsearch/Helper/Iterators/SearchResponseIterator.php

+5
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ private function clearScroll()
123123
* @return void
124124
* @see Iterator::rewind()
125125
*/
126+
#[\ReturnTypeWillChange]
126127
public function rewind()
127128
{
128129
$this->clearScroll();
@@ -137,6 +138,7 @@ public function rewind()
137138
* @return void
138139
* @see Iterator::next()
139140
*/
141+
#[\ReturnTypeWillChange]
140142
public function next()
141143
{
142144
$this->current_scrolled_response = $this->client->scroll([
@@ -153,6 +155,7 @@ public function next()
153155
* @return bool
154156
* @see Iterator::valid()
155157
*/
158+
#[\ReturnTypeWillChange]
156159
public function valid()
157160
{
158161
return isset($this->current_scrolled_response['hits']['hits'][0]);
@@ -164,6 +167,7 @@ public function valid()
164167
* @return array
165168
* @see Iterator::current()
166169
*/
170+
#[\ReturnTypeWillChange]
167171
public function current()
168172
{
169173
return $this->current_scrolled_response;
@@ -175,6 +179,7 @@ public function current()
175179
* @return int
176180
* @see Iterator::key()
177181
*/
182+
#[\ReturnTypeWillChange]
178183
public function key()
179184
{
180185
return $this->current_key;

tests/Elasticsearch/Tests/Helper/Iterators/SearchHitIteratorTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* Class SearchResponseIteratorTest
2727
*
2828
*/
29+
#[\AllowDynamicProperties]
2930
class SearchHitIteratorTest extends \PHPUnit\Framework\TestCase
3031
{
3132

tests/Elasticsearch/Tests/TransportTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
use Psr\Log\LoggerInterface;
3030
use React\Promise\Deferred;
3131

32+
#[\AllowDynamicProperties]
3233
class TransportTest extends TestCase
3334
{
3435
public function setUp(): void

0 commit comments

Comments
 (0)