From bdebad7d6293b80b18052cedfa5ee935653d71b5 Mon Sep 17 00:00:00 2001 From: Josh England Date: Wed, 2 Nov 2022 17:07:32 -0700 Subject: [PATCH] =?UTF-8?q?added=20annotations=20to=20suppress=20PHP=208.1?= =?UTF-8?q?=20return=20type=20deprecation=20warning=E2=80=A6=20(#810)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * added annotations to suppress PHP 8.1 return type deprecation warning for `IteratorAggregate::toIterator()` * move import Co-authored-by: Josh England Co-authored-by: Till Krüss --- src/Client.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Client.php b/src/Client.php index e6d731de..5f41318a 100644 --- a/src/Client.php +++ b/src/Client.php @@ -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 * * @author Daniele Alessandri */ @@ -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|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()) ));