You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Can we add generic phpDoc blocks for promises?
Example
For example in the promise interface:
<?php
namespace GuzzleHttp\Promise;
/**
* @template T
*/
interface PromiseInterface
{
// ...
/**
* @param callable(): T $onFulfilled Invoked when the promise fulfills.
* @param callable $onRejected Invoked when the promise is rejected.
* @return PromiseInterface<T>
*/
public function then(
callable $onFulfilled = null,
callable $onRejected = null
);
//...
/**
* Resolve the promise with the given value.
*
* @param T $value
*
* @throws \RuntimeException if the promise is already resolved.
*/
public function resolve($value);
/**
* Waits until the promise completes if possible.
*
* Pass $unwrap as true to unwrap the result of the promise, either
* returning the resolved value or throwing the rejected exception.
*
* If the promise cannot be waited on, then the promise will be rejected.
*
* @param bool $unwrap
*
* @return ($unwrap is true ? T : PromiseInterface)
*
* @throws \LogicException if the promise has no wait function or if the
* promise does not settle after waiting.
*/
public function wait($unwrap = true);
}
I imagine the rest of the classes need to have their docblocks updated to reflect this.
Additional context
I can help to implement this but I'm not too confident on the code base to do it alone.
Let me know what you think of this
The text was updated successfully, but these errors were encountered:
Description
Can we add generic phpDoc blocks for promises?
Example
For example in the promise interface:
I imagine the rest of the classes need to have their docblocks updated to reflect this.
Additional context
I can help to implement this but I'm not too confident on the code base to do it alone.
Let me know what you think of this
The text was updated successfully, but these errors were encountered: