Skip to content

Commit

Permalink
Merge branch 'promisor-interface'
Browse files Browse the repository at this point in the history
* promisor-interface:
  Add PromisorInterface for promise-providing objects
  • Loading branch information
igorw committed Nov 17, 2012
2 parents 8207291 + 350b379 commit ed03955
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
CHANGELOG
=========

* 1.0.3 (2012-11-17)

* Add `PromisorInterface` for objects that have a `promise()` method.

* 1.0.2 (2012-11-14)

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Table of Contents
* [When::reduce()](#whenreduce)
* [When::resolve()](#whenresolve)
* [When::reject()](#whenreject)
* [Promisor](#promisor)
4. [Examples](#examples)
* [How to use Deferred](#how-to-use-deferred)
* [How Promise forwarding works](#how-promise-forwarding-works)
Expand Down Expand Up @@ -275,6 +276,12 @@ This can be useful in situations where you need to reject a Promise without
throwing an exception. For example, it allows you to propagate a rejection with
the value of another Promise.

### Promisor

The `React\Promise\PromisorInterface` provides a common interface for objects
that provide a promise. `React\Promise\Deferred` implements it, but since it
is part of the public API anyone can implement it.

Examples
--------

Expand Down
2 changes: 1 addition & 1 deletion src/React/Promise/Deferred.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace React\Promise;

class Deferred implements PromiseInterface, ResolverInterface
class Deferred implements PromiseInterface, ResolverInterface, PromisorInterface
{
private $completed;
private $promise;
Expand Down
8 changes: 8 additions & 0 deletions src/React/Promise/PromisorInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace React\Promise;

interface PromisorInterface
{
public function promise();
}

0 comments on commit ed03955

Please sign in to comment.