Replies: 1 comment 5 replies
-
Hey @roxblnfk, thank you for bringing this up. @WyriHaximus is currently working on ticket reactphp/async#40, where he will define template types for the coroutine function. By the way, if you happen to use async in version With that in mind I will ping @SimonFrings to go ahead and close reactphp/promise#254 as @WyriHaximus is working on reactphp/async#40. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I often use React Promises in coroutines. It's hard without type hints in the IDE when a result comes from a
yield $promise
.We can fix this with the
@yield
annotation. Adding@yield T
to thePromiseInterface
lets us set the return type for static analyzers and the IDE.I don't know if PhpStan supports this, I only found a feature request here: phpstan/phpstan#4245.
But, Psalm and PhpStorm support it.
I use
VirtualPromise
, which extends thePromiseInterface
, just for typing in annotations.PR: reactphp/promise#254
Beta Was this translation helpful? Give feedback.
All reactions