Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add phpdoc templates to PromiseInterface #175

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from

Conversation

bshaffer
Copy link

@bshaffer bshaffer commented Dec 2, 2024

partially addresses #163

@@ -82,7 +84,7 @@ public function cancel(): void;
*
* If the promise cannot be waited on, then the promise will be rejected.
*
* @return mixed
* @return T|PromiseInterface<T>
Copy link

@ojhaujjwal ojhaujjwal Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think PromiseInterface<T> is entirely correct.

/** @var PromiseInterface<int> $promise */
$promise = new FulfilledPromise(2);

/** @var PromiseInterface<bool> $result */
$result = $promise->then(fn ($num) => $num %2 = 0);

The return of the callback should determine the new template type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants