private static function awaitPromise($promise) { $results = null; $promise->then(function (ExecutionResult $executionResult) use(&$results) { $results = $executionResult->toArray(); }); return $results; }