Conversation
Most of the composite methods return a boolean result indicating whether
or not all of the child handlers successfully performed the operation.
If any of the children fails, the composite result is false.
We were previously using a mix of coding styles:
1. $success = $success && func()
2. $success &= func()
3. if (!func()) { $success = false; }
(1) works fine but results in more (re)writes to $success than are
needed.
(2) is logically equivalent but promotes the value to an integer, which
results in the composite function returning an integer instead of a
boolean. (#40)
(3) is nice because it leaves the $success flag alone until there's a
reason to change it to a failure.
This change updates all of the code to consistently use (3).
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.
Most of the composite methods return a boolean result indicating whether or not all of the child handlers successfully performed the operation. If any of the children fails, the composite result is false.
We were previously using a mix of coding styles:
$success = $success && func()$success &= func()if (!func()) { $success = false; }(1) works fine but results in more (re)writes to
$successthan are needed.(2) is logically equivalent but promotes the value to an integer, which results in the composite function returning an integer instead of a boolean. (#40)
(3) is nice because it leaves the
$successflag alone until there's a reason to change it to a failure.This change updates all of the code to consistently use (3).
Fixed #40