Преглед на файлове

Rework PR to use "goto" instead of a "while ... do" loop.

Daniele Alessandri преди 10 години
родител
ревизия
2d53db7b9b
променени са 1 файла, в които са добавени 3 реда и са изтрити 5 реда
  1. 3 5
      lib/Predis/Collection/Iterator/CursorBasedIterator.php

+ 3 - 5
lib/Predis/Collection/Iterator/CursorBasedIterator.php

@@ -165,9 +165,7 @@ abstract class CursorBasedIterator implements Iterator
      */
     public function next()
     {
-        do {
-            $more = false;
-
+        tryFetch: {
             if (!$this->elements && $this->fetchmore) {
                 $this->fetch();
             }
@@ -175,11 +173,11 @@ abstract class CursorBasedIterator implements Iterator
             if ($this->elements) {
                 $this->extractNext();
             } elseif ($this->cursor) {
-                $more = true;
+                goto tryFetch;
             } else {
                 $this->valid = false;
             }
-        } while ($more);
+        }
     }
 
     /**