This commit is contained in:
2026-02-02 15:18:51 +01:00
parent 7a26dd69a5
commit ae0ee002ec
170 changed files with 7446 additions and 1519 deletions

View File

@@ -12,8 +12,6 @@ namespace Http\Promise;
*
* @author Joel Wurtz <joel.wurtz@gmail.com>
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
*
* @template-covariant T
*/
interface Promise
{
@@ -38,14 +36,12 @@ interface Promise
* If you do not care about one of the cases, you can set the corresponding callable to null
* The callback will be called when the value arrived and never more than once.
*
* @param callable(T): V|null $onFulfilled called when a response will be available
* @param callable(\Exception): V|null $onRejected called when an exception occurs
* @param callable|null $onFulfilled called when a response will be available
* @param callable|null $onRejected called when an exception occurs
*
* @return Promise<V> a new resolved promise with value of the executed callback (onFulfilled / onRejected)
*
* @template V
* @return Promise a new resolved promise with value of the executed callback (onFulfilled / onRejected)
*/
public function then(callable $onFulfilled = null, callable $onRejected = null);
public function then(?callable $onFulfilled = null, ?callable $onRejected = null);
/**
* Returns the state of the promise, one of PENDING, FULFILLED or REJECTED.
@@ -65,9 +61,9 @@ interface Promise
*
* @param bool $unwrap Whether to return resolved value / throw reason or not
*
* @return T Resolved value, null if $unwrap is set to false
* @return ($unwrap is true ? mixed : null) Resolved value, null if $unwrap is set to false
*
* @throws \Exception the rejection reason if $unwrap is set to true and the request failed
* @throws \Throwable the rejection reason if $unwrap is set to true and the request failed
*/
public function wait($unwrap = true);
}