1<?php 2 3namespace React\Promise; 4 5interface PromiseInterface 6{ 7 /** 8 * Transforms a promise's value by applying a function to the promise's fulfillment 9 * or rejection value. Returns a new promise for the transformed result. 10 * 11 * The `then()` method registers new fulfilled and rejection handlers with a promise 12 * (all parameters are optional): 13 * 14 * * `$onFulfilled` will be invoked once the promise is fulfilled and passed 15 * the result as the first argument. 16 * * `$onRejected` will be invoked once the promise is rejected and passed the 17 * reason as the first argument. 18 * * `$onProgress` (deprecated) will be invoked whenever the producer of the promise 19 * triggers progress notifications and passed a single argument (whatever it 20 * wants) to indicate progress. 21 * 22 * It returns a new promise that will fulfill with the return value of either 23 * `$onFulfilled` or `$onRejected`, whichever is called, or will reject with 24 * the thrown exception if either throws. 25 * 26 * A promise makes the following guarantees about handlers registered in 27 * the same call to `then()`: 28 * 29 * 1. Only one of `$onFulfilled` or `$onRejected` will be called, 30 * never both. 31 * 2. `$onFulfilled` and `$onRejected` will never be called more 32 * than once. 33 * 3. `$onProgress` (deprecated) may be called multiple times. 34 * 35 * @param callable|null $onFulfilled 36 * @param callable|null $onRejected 37 * @param callable|null $onProgress This argument is deprecated and should not be used anymore. 38 * @return PromiseInterface 39 */ 40 public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null); 41} 42