Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ The `promise` method returns the promise of the deferred.

The `resolve` and `reject` methods control the state of the deferred.

The `notify` method is for progress notification.
The deprecated `notify` method is for progress notification.

The constructor of the `Deferred` accepts an optional `$canceller` argument.
See [Promise](#promise-2) for more information.
Expand Down Expand Up @@ -146,6 +146,8 @@ of this promise regardless whether it fulfills or rejects.

#### Deferred::notify()

> Deprecated in v2.6.0: Progress support is deprecated and should not be used anymore.

```php
$deferred->notify(mixed $update = null);
```
Expand Down Expand Up @@ -190,7 +192,7 @@ with a promise (all parameters are optional):
the result as the first argument.
* `$onRejected` will be invoked once the promise is rejected and passed the
reason as the first argument.
* `$onProgress` will be invoked whenever the producer of the promise
* `$onProgress` (deprecated) will be invoked whenever the producer of the promise
triggers progress notifications and passed a single argument (whatever it
wants) to indicate progress.

Expand All @@ -205,7 +207,7 @@ the same call to `then()`:
never both.
2. `$onFulfilled` and `$onRejected` will never be called more
than once.
3. `$onProgress` may be called multiple times.
3. `$onProgress` (deprecated) may be called multiple times.

#### See also

Expand Down Expand Up @@ -321,6 +323,8 @@ return doSomething()

#### ExtendedPromiseInterface::progress()

> Deprecated in v2.6.0: Progress support is deprecated and should not be used anymore.

```php
$promise->progress(callable $onProgress);
```
Expand Down Expand Up @@ -364,7 +368,7 @@ Creates a promise whose state is controlled by the functions passed to
```php
$resolver = function (callable $resolve, callable $reject, callable $notify) {
// Do some work, possibly asynchronously, and then
// resolve or reject. You can notify of progress events
// resolve or reject. You can notify of progress events (deprecated)
// along the way if you want/need.

$resolve($awesomeResult);
Expand All @@ -391,7 +395,7 @@ function which both will be called with 3 arguments:
When called with another promise, e.g. `$resolve($otherPromise)`, promise's
fate will be equivalent to that of `$otherPromise`.
* `$reject($reason)` - Function that rejects the promise.
* `$notify($update)` - Function that issues progress events for the promise.
* `$notify($update)` - Deprecated function that issues progress events for the promise.

If the resolver or canceller throw an exception, the promise will be rejected
with that thrown exception as the rejection reason.
Expand Down Expand Up @@ -721,6 +725,8 @@ $deferred->resolve(1); // Prints "Mixed 4"

#### Progress event forwarding

> Deprecated in v2.6.0: Progress support is deprecated and should not be used anymore.

In the same way as resolution and rejection handlers, your progress handler
**MUST** return a progress event to be propagated to the next link in the chain.
If you return nothing, `null` will be propagated.
Expand Down
4 changes: 4 additions & 0 deletions src/Deferred.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public function reject($reason = null)
call_user_func($this->rejectCallback, $reason);
}

/**
* @deprecated 2.6.0 Progress support is deprecated and should not be used anymore.
* @param mixed $update
*/
public function notify($update = null)
{
$this->promise();
Expand Down
4 changes: 4 additions & 0 deletions src/ExtendedPromiseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
interface ExtendedPromiseInterface extends PromiseInterface
{
/**
*
* The `$onProgress` argument is deprecated and should not be used anymore.
*
* @return void
*/
public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null);
Expand All @@ -21,6 +24,7 @@ public function always(callable $onFulfilledOrRejected);

/**
* @return ExtendedPromiseInterface
* @deprecated 2.6.0 Progress support is deprecated and should not be used anymore.
*/
public function progress(callable $onProgress);
}
3 changes: 3 additions & 0 deletions src/PromiseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
interface PromiseInterface
{
/**
*
* The `$onProgress` argument is deprecated and should not be used anymore.
*
* @return PromiseInterface
*/
public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null);
Expand Down