File tree Expand file tree Collapse file tree 5 files changed +11
-10
lines changed
src/Symfony/Component/Form
Tests/Extension/Core/Type Expand file tree Collapse file tree 5 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ public function configureOptions(OptionsResolver $resolver)
37
37
{
38
38
$ resolver ->setDefaults ([
39
39
'compound ' => false ,
40
+ 'empty_data ' => '' ,
40
41
]);
41
42
}
42
43
@@ -62,6 +63,6 @@ public function transform($data)
62
63
*/
63
64
public function reverseTransform ($ data )
64
65
{
65
- return null === $ data ? '' : $ data ;
66
+ return $ data ?? '' ;
66
67
}
67
68
}
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ public function validationShouldFailProvider()
82
82
];
83
83
}
84
84
85
- public function testSubmitNull ($ expected = null , $ norm = null , $ view = null )
85
+ public function testSubmitNull ($ expected = '' , $ norm = '' , $ view = '' )
86
86
{
87
87
parent ::testSubmitNull ($ expected , $ norm , '' );
88
88
}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public function testNotTrimmed()
47
47
$ this ->assertSame (' pAs5w0rd ' , $ form ->getData ());
48
48
}
49
49
50
- public function testSubmitNull ($ expected = null , $ norm = null , $ view = null )
50
+ public function testSubmitNull ($ expected = '' , $ norm = '' , $ view = '' )
51
51
{
52
52
parent ::testSubmitNull ($ expected , $ norm , '' );
53
53
}
Original file line number Diff line number Diff line change @@ -15,27 +15,27 @@ class TextTypeTest extends BaseTypeTest
15
15
{
16
16
public const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\TextType ' ;
17
17
18
- public function testSubmitNull ($ expected = null , $ norm = null , $ view = null )
18
+ public function testSubmitNull ($ expected = '' , $ norm = '' , $ view = '' )
19
19
{
20
20
parent ::testSubmitNull ($ expected , $ norm , '' );
21
21
}
22
22
23
23
public function testSubmitNullReturnsNullWithEmptyDataAsString ()
24
24
{
25
25
$ form = $ this ->factory ->create (static ::TESTED_TYPE , 'name ' , [
26
- 'empty_data ' => '' ,
26
+ 'empty_data ' => null ,
27
27
]);
28
28
29
29
$ form ->submit (null );
30
- $ this ->assertSame ( '' , $ form ->getData ());
31
- $ this ->assertSame ( '' , $ form ->getNormData ());
30
+ $ this ->assertNull ( $ form ->getData ());
31
+ $ this ->assertNull ( $ form ->getNormData ());
32
32
$ this ->assertSame ('' , $ form ->getViewData ());
33
33
}
34
34
35
35
public function provideZeros ()
36
36
{
37
37
return [
38
- [0 , ' 0 ' ],
38
+ [0 , 0 ],
39
39
['0 ' , '0 ' ],
40
40
['00000 ' , '00000 ' ],
41
41
];
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public function testSubmitAddsNoDefaultProtocolIfEmpty()
47
47
48
48
$ form ->submit ('' );
49
49
50
- $ this ->assertNull ( $ form ->getData ());
50
+ $ this ->assertSame ( '' , $ form ->getData ());
51
51
$ this ->assertSame ('' , $ form ->getViewData ());
52
52
}
53
53
@@ -59,7 +59,7 @@ public function testSubmitAddsNoDefaultProtocolIfNull()
59
59
60
60
$ form ->submit (null );
61
61
62
- $ this ->assertNull ( $ form ->getData ());
62
+ $ this ->assertSame ( '' , $ form ->getData ());
63
63
$ this ->assertSame ('' , $ form ->getViewData ());
64
64
}
65
65
You can’t perform that action at this time.
0 commit comments