iterate not iterable connections #552

This commit is contained in:
Peter Gribanov
2019-03-25 19:31:56 +03:00
committed by Peter Gribanov
parent 111d100ee3
commit 4363345f7c
2 changed files with 10 additions and 6 deletions
+3 -1
View File
@@ -535,7 +535,9 @@ class Client implements ClientInterface, \IteratorAggregate
$connection = $this->getConnection();
if (!$connection instanceof \Traversable) {
throw new ClientException('The underlying connection is not traversable');
return new \ArrayIterator(array(
(string) $connection => new static($connection, $this->getOptions())
));
}
foreach ($connection as $node) {