From e8e3ea7f7b95beed5ac4c15f05077347695135d9 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Tue, 21 Mar 2017 19:16:25 -0500 Subject: [PATCH] =?UTF-8?q?when()=20=E2=86=92=20onResolve()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Listener.php | 2 +- lib/PgSqlConnection.php | 2 +- lib/PgSqlExecutor.php | 2 +- lib/PqConnection.php | 2 +- lib/PqExecutor.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Listener.php b/lib/Listener.php index 3334bc5..91b86d7 100644 --- a/lib/Listener.php +++ b/lib/Listener.php @@ -39,7 +39,7 @@ class Listener extends StreamListener implements Operation { public function unlisten(): Promise { /** @var \Amp\Promise $promise */ $promise = ($this->unlisten)($this->channel); - $promise->when(function () { + $promise->onResolve(function () { $this->complete(); }); return $promise; diff --git a/lib/PgSqlConnection.php b/lib/PgSqlConnection.php index c3be2c6..7591296 100644 --- a/lib/PgSqlConnection.php +++ b/lib/PgSqlConnection.php @@ -53,7 +53,7 @@ class PgSqlConnection extends AbstractConnection { $promise = Promise\timeout($promise, $timeout); } - $promise->when(function ($exception) use ($connection, $poll, $await) { + $promise->onResolve(function ($exception) use ($connection, $poll, $await) { if ($exception) { \pg_close($connection); } diff --git a/lib/PgSqlExecutor.php b/lib/PgSqlExecutor.php index 59fd2f3..b4bae2f 100644 --- a/lib/PgSqlExecutor.php +++ b/lib/PgSqlExecutor.php @@ -252,7 +252,7 @@ class PgSqlExecutor implements Executor { } $promise = $this->query(\sprintf("UNLISTEN %s", $channel)); - $promise->when(function () use ($emitter) { + $promise->onResolve(function () use ($emitter) { $emitter->resolve(); }); return $promise; diff --git a/lib/PqConnection.php b/lib/PqConnection.php index dd55c21..500b5f1 100644 --- a/lib/PqConnection.php +++ b/lib/PqConnection.php @@ -52,7 +52,7 @@ class PqConnection extends AbstractConnection { $promise = Promise\timeout($promise, $timeout); } - $promise->when(function () use ($poll, $await) { + $promise->onResolve(function () use ($poll, $await) { Loop::cancel($poll); Loop::cancel($await); }); diff --git a/lib/PqExecutor.php b/lib/PqExecutor.php index 0fb190d..68e1d12 100644 --- a/lib/PqExecutor.php +++ b/lib/PqExecutor.php @@ -274,7 +274,7 @@ class PqExecutor implements Executor { } $promise = new Coroutine($this->send([$this->handle, "unlistenAsync"], $channel)); - $promise->when(function () use ($emitter) { + $promise->onResolve(function () use ($emitter) { $emitter->resolve(); }); return $promise;