-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Config] Add ifFalse()
#59325
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
Merged
Merged
[Config] Add ifFalse()
#59325
Conversation
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
derrabus
approved these changes
Dec 30, 2024
welcoMattic
approved these changes
Dec 30, 2024
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.
Lil typo in commit message 🫣
Thanks @OskarStark!
GromNaN
approved these changes
Dec 30, 2024
1282513
to
c99791a
Compare
Fixed, thanks |
c99791a
to
4eec7fb
Compare
fabpot
approved these changes
Dec 30, 2024
Some broken tests looks related (8.2 low-deps for instance). |
072fec2
to
17125b9
Compare
Indeed, fixed and rebased, thanks |
5e0bac7
to
b85beb6
Compare
Thank you @OskarStark. |
OskarStark
added a commit
to OskarStark/symfony
that referenced
this pull request
Jan 2, 2025
nicolas-grekas
added a commit
that referenced
this pull request
Mar 21, 2025
…sure based checks (arjenm) This PR was squashed before being merged into the 7.3 branch. Discussion ---------- [Config] Make ifFalse() consistent between value and closure based checks | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #59325 | License | MIT I noticed the Config/ExpBuilder got a nice new ifFalse in Symfony 7.3. But I think its implementation is confusing. The behavior for `ifTrue()` was: - If no closure is provided: if the actual value is `true` execute the then part - If a closure is provided: if it returns `true` execute the then part The behavior for `ifFalse()` is prior to this PR is: - If no closure is provided: if the actual value is `false` execute the then part - If a closure is provided: if it returns **`true`** execute the then part With this PR it becomes: - If no closure is provided: if the actual value is `false` execute the then part - If a closure is provided: if it returns **`false`** execute the then part Rationale, I think people (me included) would not expect these to be both be valid or invalid with the same input: `$expr->ifTrue(self::valueIsNotValid(...))->thenInvalid()` `$expr->ifFalse(self::valueIsNotValid(...))->thenInvalid()` They/I expect to have to change it to a test for valid values (rather than invalid ones): `$expr->ifFalse(self::valueIsValid(...))->thenInvalid()` Commits ------- 335bdbe [Config] Make ifFalse() consistent between value and closure based checks
Merged
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.
Spottet while working on
false
for "no tools" php-llm/llm-chain-bundle#55It is much easier to use like IMHO: