Skip to content

Commit

Permalink
Fixed some PHP deprecations for PHP 8
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Apr 12, 2024
1 parent 5ecee56 commit 3d2d852
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion composer.json
Expand Up @@ -48,7 +48,10 @@
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"php-http/discovery": true
}
},
"scripts": {
"phpcs": [
Expand Down
6 changes: 6 additions & 0 deletions src/Elasticsearch/Helper/Iterators/SearchHitIterator.php
Expand Up @@ -69,6 +69,7 @@ public function __construct(SearchResponseIterator $search_responses)
* @return void
* @see Iterator::rewind()
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->current_key = 0;
Expand Down Expand Up @@ -96,6 +97,7 @@ public function rewind()
* @return void
* @see Iterator::next()
*/
#[\ReturnTypeWillChange]
public function next()
{
$this->current_key++;
Expand All @@ -115,6 +117,7 @@ public function next()
* @return bool
* @see Iterator::valid()
*/
#[\ReturnTypeWillChange]
public function valid()
{
return is_array($this->current_hit_data);
Expand All @@ -126,6 +129,7 @@ public function valid()
* @return array
* @see Iterator::current()
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->current_hit_data;
Expand All @@ -137,6 +141,7 @@ public function current()
* @return int
* @see Iterator::key()
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->current_key;
Expand All @@ -161,6 +166,7 @@ private function readPageData()
/**
* {@inheritDoc}
*/
#[\ReturnTypeWillChange]
public function count()
{
if ($this->count === null) {
Expand Down
5 changes: 5 additions & 0 deletions src/Elasticsearch/Helper/Iterators/SearchResponseIterator.php
Expand Up @@ -123,6 +123,7 @@ private function clearScroll()
* @return void
* @see Iterator::rewind()
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->clearScroll();
Expand All @@ -137,6 +138,7 @@ public function rewind()
* @return void
* @see Iterator::next()
*/
#[\ReturnTypeWillChange]
public function next()
{
$this->current_scrolled_response = $this->client->scroll([
Expand All @@ -153,6 +155,7 @@ public function next()
* @return bool
* @see Iterator::valid()
*/
#[\ReturnTypeWillChange]
public function valid()
{
return isset($this->current_scrolled_response['hits']['hits'][0]);
Expand All @@ -164,6 +167,7 @@ public function valid()
* @return array
* @see Iterator::current()
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->current_scrolled_response;
Expand All @@ -175,6 +179,7 @@ public function current()
* @return int
* @see Iterator::key()
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->current_key;
Expand Down
Expand Up @@ -26,6 +26,7 @@
* Class SearchResponseIteratorTest
*
*/
#[\AllowDynamicProperties]
class SearchHitIteratorTest extends \PHPUnit\Framework\TestCase
{

Expand Down
1 change: 1 addition & 0 deletions tests/Elasticsearch/Tests/TransportTest.php
Expand Up @@ -29,6 +29,7 @@
use Psr\Log\LoggerInterface;
use React\Promise\Deferred;

#[\AllowDynamicProperties]
class TransportTest extends TestCase
{
public function setUp(): void
Expand Down

0 comments on commit 3d2d852

Please sign in to comment.