added annotations to suppress PHP 8.1 return type deprecation warning… (#810)

* added annotations to suppress PHP 8.1 return type deprecation warning for `IteratorAggregate::toIterator()`

* move import

Co-authored-by: Josh England <joshua.england@trinet.com>
Co-authored-by: Till Krüss <tillkruss@users.noreply.github.com>
This commit is contained in:
Josh England
2022-11-02 17:07:32 -07:00
committed by GitHub
parent 1a411d2ad7
commit bdebad7d62
+8 -2
View File
@@ -11,6 +11,8 @@
namespace Predis;
use Traversable;
use Predis\Command\CommandInterface;
use Predis\Command\RawCommand;
use Predis\Command\ScriptCommand;
@@ -35,6 +37,9 @@ use Predis\Transaction\MultiExec as MultiExecTransaction;
* one with its own responsibility and scope.
*
* {@inheritdoc}
* @template TKey
* @template TValue
* @template-implements Traversable<TKey, TValue>
*
* @author Daniele Alessandri <suppakilla@gmail.com>
*/
@@ -378,7 +383,7 @@ class Client implements ClientInterface, \IteratorAggregate
: $this->$initializer(null, $argv[0]);
case 2:
list($arg0, $arg1) = $argv;
[$arg0, $arg1] = $argv;
return $this->$initializer($arg0, $arg1);
@@ -512,6 +517,7 @@ class Client implements ClientInterface, \IteratorAggregate
/**
* {@inheritdoc}
* @return Traversable<TKey, TValue>|TValue[]
*/
#[\ReturnTypeWillChange]
public function getIterator()
@@ -519,7 +525,7 @@ class Client implements ClientInterface, \IteratorAggregate
$clients = array();
$connection = $this->getConnection();
if (!$connection instanceof \Traversable) {
if (!$connection instanceof Traversable) {
return new \ArrayIterator(array(
(string) $connection => new static($connection, $this->getOptions())
));