Skip to content

Commit 9a83abc

Browse files
committed
Merge pull request #10 from clue-labs/await
Rename awaitOne() to await()
2 parents 5af4f27 + 9c8f54f commit 9a83abc

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ $blocker = new Blocker($loop);
6969

7070
The `sleep($seconds)` method can be used to wait/sleep for $time seconds.
7171

72-
#### awaitOne()
72+
#### await()
7373

74-
The `awaitOne(PromiseInterface $promise)` method can be used to block waiting for the given $promise to resolve.
74+
The `await(PromiseInterface $promise)` method can be used to block waiting for the given $promise to resolve.
7575

7676
#### awaitAny()
7777

src/Blocker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function sleep($time)
4343
* @return mixed returns whatever the promise resolves to
4444
* @throws Exception when the promise is rejected
4545
*/
46-
public function awaitOne(PromiseInterface $promise)
46+
public function await(PromiseInterface $promise)
4747
{
4848
$wait = true;
4949
$resolved = null;

tests/BlockerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@ public function testAwaitOneRejected()
2828
$promise = $this->createPromiseRejected(new Exception('test'));
2929

3030
$this->setExpectedException('Exception', 'test');
31-
$this->block->awaitOne($promise);
31+
$this->block->await($promise);
3232
}
3333

3434
public function testAwaitOneResolved()
3535
{
3636
$promise = $this->createPromiseResolved(2);
3737

38-
$this->assertEquals(2, $this->block->awaitOne($promise));
38+
$this->assertEquals(2, $this->block->await($promise));
3939
}
4040

4141
public function testAwaitOneInterrupted()
4242
{
4343
$promise = $this->createPromiseResolved(2, 0.02);
4444
$this->createTimerInterrupt(0.01);
4545

46-
$this->assertEquals(2, $this->block->awaitOne($promise));
46+
$this->assertEquals(2, $this->block->await($promise));
4747
}
4848

4949
/**

0 commit comments

Comments
 (0)