Skip to content

Commit

Permalink
Merge pull request #276 from mrtnmtth/3.x
Browse files Browse the repository at this point in the history
Fix PHP 8.1 deprecations.
  • Loading branch information
markstory authored Feb 16, 2022
2 parents bdbda43 + c3d6510 commit 62a8c35
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/ResultSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ public function countSuggests()
*
* @return \Cake\ElasticSearch\Document
*/
#[\ReturnTypeWillChange]
public function current()
{
$class = $this->entityClass;
Expand Down Expand Up @@ -255,6 +256,16 @@ public function serialize()
return serialize([ $this->resultSet, $this->queryObject ]);
}

/**
* Magic method for serializing the ResultSet instance
*
* @return array
*/
public function __serialize(): array
{
return [$this->resultSet, $this->queryObject];
}

/**
* Unserializes the passed string and rebuilds the ResultSet instance
*
Expand All @@ -266,6 +277,17 @@ public function unserialize($serialized)
$this->__construct(...unserialize($serialized));
}

/**
* Magic method for unserializing the ResultSet instance
*
* @param array $data The serialized data
* @return void
*/
public function __unserialize(array $data): void
{
$this->__construct(...$data);
}

/**
* Debug output hook method.
*
Expand Down

0 comments on commit 62a8c35

Please sign in to comment.