-
-
Notifications
You must be signed in to change notification settings - Fork 16
Added support for ReactPHP Promise v3 #53
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
Changes from 4 commits
c38cd2d
6757d99
ed86a7b
6430bad
a3fcb95
c91da1f
b38731c
96f3e35
d3d5a36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,8 +34,10 @@ public function testAwaitAllRejected() | |
| Block\awaitAll($all, $this->loop); | ||
| } | ||
|
|
||
| public function testAwaitAllRejectedWithFalseWillWrapInUnexpectedValueException() | ||
| public function testAwaitAllRejectedWithExceptionWillWrapInUnexpectedValueException() | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like the name should not have been changed as the logic didn't actually change?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops - accident! |
||
| { | ||
| $this->skipForPromise3(); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see why you've decided to add a helper method for this, but I wonder if it could be more descriptive if we added a reason each time? What do you think? See also all following occurrences.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a |
||
|
|
||
| $all = array( | ||
| $this->createPromiseResolved(1), | ||
| Promise\reject(false) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ public function testAwaitAnyEmpty() | |
| public function testAwaitAnyFirstResolved() | ||
| { | ||
| $all = array( | ||
| $this->createPromiseRejected(1), | ||
| $this->createPromiseRejected(new \Exception(1)), | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor nit only: First argument is a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assuming you mean about the first argument of |
||
| $this->createPromiseResolved(2, 0.01), | ||
| $this->createPromiseResolved(3, 0.02) | ||
| ); | ||
|
|
@@ -33,7 +33,7 @@ public function testAwaitAnyFirstResolvedConcurrently() | |
| $d3 = new Deferred(); | ||
|
|
||
| $this->loop->addTimer(0.01, function() use ($d1, $d2, $d3) { | ||
| $d1->reject(1); | ||
| $d1->reject(new \Exception(1)); | ||
| $d2->resolve(2); | ||
| $d3->resolve(3); | ||
| }); | ||
|
|
@@ -50,8 +50,8 @@ public function testAwaitAnyFirstResolvedConcurrently() | |
| public function testAwaitAnyAllRejected() | ||
| { | ||
| $all = array( | ||
| $this->createPromiseRejected(1), | ||
| $this->createPromiseRejected(2) | ||
| $this->createPromiseRejected(new \Exception(1)), | ||
| $this->createPromiseRejected(new \Exception(2)) | ||
| ); | ||
|
|
||
| $this->setExpectedException('UnderflowException'); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! I see why this was done, but it looks like static analysis complains about this because
resolve()has aPromiseInterfacereturn type for Promise v2 and Promise v1.Perhaps use logic similar to https://github.com/reactphp/promise-timer/pull/37/files#diff-fe65dcdace9cc44252b537bee79dd574edd1bccf6cee646cc860006a6ec50e8bR15? /cc @WyriHaximus
What do you think about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is the preferred way, making it more explicit, and more performant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I thought so, had this initially but changed it due to this comment. I'll change it back as it's more lightweight.