Conversation
Also removes trigger_error's for non-function arguments and related tests
src/React/Promise/Promise.php
Outdated
Contributor
There was a problem hiding this comment.
can just be [$this, 'resolve']
Member
Author
There was a problem hiding this comment.
No, because resolve is private. The closure is needed for the class scope.
Contributor
There was a problem hiding this comment.
could this be simply [$this, 'resolve']?
Contributor
There was a problem hiding this comment.
LOL again? :) /me slaps himself...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The goal is to streamline the API and to make it more compliant with other promise libraries and especially with the new upcoming ES6 promises specification.
Provides an alternative promise-creation API that has the same power as the deferred concept, but without introducing another conceptual entity plus it's identical with the Promise object from the upcoming ES6 promises specification.
Initiates a competitive race that allows one winner. Returns a promise which is resolved in the same way the first settled promise resolves (See also ES6 spec).
Allows the callable typehint (see a4d6358, removes the hacky error triggering from a0f23cb).
$thiscan be used in anonymous functions (example).Usage of
Deferred::thenhas been always discouraged and it only existed because it was used by the (now removed)DeferredPromiseclass. Removed theResolverInterfaceentirely for the sake of simplicity. I haven't come across any single userland usage.Added the callable typehint and renamed arguments to be compliant with the ES6 promises specification and Promise/A+ naming conventions.
FFTW (Functions For The Win).
This is more a bugfix than a BC break. Since FulfilledPromise and RejectedPromise are now documented in the API docs, i fixed it. In 1.0, we only documented
When::resolve()andWhen::reject()as public API which only creates instances if value/reason was not a promise.