Skip to content

Commit

Permalink
Clarify Promise::when docblock
Browse files Browse the repository at this point in the history
It specifies the exact invocation parameter values now and includes a statement about always-sync when callbacks.

Closes #20.
  • Loading branch information
kelunik committed Dec 23, 2016
1 parent 8c50edd commit 604ef4c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ interface Promise
/**
* Registers a callback to be invoked when the promise is resolved.
*
* @param callable(\Throwable|\Exception|null $exception, mixed $result) $onResolved
* The callback receives `null` as first parameter and `$value` as second parameter on success. It receives the
* failure reason as first parameter and `null` as second parameter on failure.
*
* If the promise is already resolved, the callback MUST be executed immediately.
*
* Warning: If you use type declarations for `$value`, be sure to make them accept `null` in case of failures.
*
* @param callable(\Throwable|\Exception|null $exception, mixed $value) $onResolved Callback to be executed.
*
* @return void
*/
Expand Down

0 comments on commit 604ef4c

Please sign in to comment.