diff --git a/src/future/Future.php b/src/future/Future.php --- a/src/future/Future.php +++ b/src/future/Future.php @@ -14,6 +14,7 @@ private $exception; private $futureKey; private $serviceProfilerCallID; + private static $nextKey = 1; /** * Is this future's process complete? Specifically, can this future be @@ -242,10 +243,8 @@ } final public function getFutureKey() { - static $next_key = 1; - if ($this->futureKey === null) { - $this->futureKey = sprintf('Future/%d', $next_key++); + $this->futureKey = sprintf('Future/%d', self::$nextKey++); } return $this->futureKey; diff --git a/src/future/FutureIterator.php b/src/future/FutureIterator.php --- a/src/future/FutureIterator.php +++ b/src/future/FutureIterator.php @@ -58,12 +58,8 @@ public function __construct(array $futures) { assert_instances_of($futures, 'Future'); - $respect_keys = !phutil_is_natural_list($futures); - foreach ($futures as $map_key => $future) { - if ($respect_keys) { - $future->setFutureKey($map_key); - } + $future->setFutureKey($map_key); $this->addFuture($future); } }