File tree Expand file tree Collapse file tree 2 files changed +2
-14
lines changed
src/Symfony/Component/Config Expand file tree Collapse file tree 2 files changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ public function always(?\Closure $then = null): static
61
61
*/
62
62
public function ifTrue (?\Closure $ closure = null ): static
63
63
{
64
- $ this ->ifPart = $ closure ?? static fn ($ v ) => ( bool ) $ v ;
64
+ $ this ->ifPart = $ closure ?? static fn ($ v ) => true === $ v ;
65
65
$ this ->allowedTypes = self ::TYPE_ANY ;
66
66
67
67
return $ this ;
@@ -76,7 +76,7 @@ public function ifTrue(?\Closure $closure = null): static
76
76
*/
77
77
public function ifFalse (?\Closure $ closure = null ): static
78
78
{
79
- $ this ->ifPart = $ closure ? static fn ($ v ) => ! $ closure ($ v ) : static fn ($ v ) => ! $ v ;
79
+ $ this ->ifPart = $ closure ? static fn ($ v ) => !$ closure ($ v ) : static fn ($ v ) => false === $ v ;
80
80
$ this ->allowedTypes = self ::TYPE_ANY ;
81
81
82
82
return $ this ;
Original file line number Diff line number Diff line change @@ -36,12 +36,6 @@ public function testIfTrueExpression()
36
36
->end ();
37
37
$ this ->assertFinalizedValueIs ('new_value ' , $ test , ['key ' => true ]);
38
38
39
- $ test = $ this ->getTestBuilder ()
40
- ->ifTrue ()
41
- ->then ($ this ->returnClosure ('new_value ' ))
42
- ->end ();
43
- $ this ->assertFinalizedValueIs ('new_value ' , $ test , ['key ' => 1 ]);
44
-
45
39
$ test = $ this ->getTestBuilder ()
46
40
->ifTrue (fn () => true )
47
41
->then ($ this ->returnClosure ('new_value ' ))
@@ -75,12 +69,6 @@ public function testIfFalseExpression()
75
69
->end ();
76
70
$ this ->assertFinalizedValueIs ('new_value ' , $ test , ['key ' => false ]);
77
71
78
- $ test = $ this ->getTestBuilder ()
79
- ->ifFalse ()
80
- ->then ($ this ->returnClosure ('new_value ' ))
81
- ->end ();
82
- $ this ->assertFinalizedValueIs ('new_value ' , $ test , ['key ' => 0 ]);
83
-
84
72
$ test = $ this ->getTestBuilder ()
85
73
->ifFalse (fn ($ v ) => 'value ' === $ v )
86
74
->then ($ this ->returnClosure ('new_value ' ))
You can’t perform that action at this time.
0 commit comments