1616 */
1717class ElementTest extends TestCase
1818{
19- public function testCanSerializeValidElementToJson ()
19+ public function testCanSerializeValidElementToJson (): void
2020 {
2121 $ element = $ this ->getMockElement ();
2222
@@ -26,14 +26,14 @@ public function testCanSerializeValidElementToJson()
2626 ]);
2727 }
2828
29- public function testThrowsErrorElementIsInvalid ()
29+ public function testThrowsErrorElementIsInvalid (): void
3030 {
3131 $ this ->expectException (Exception::class);
3232 $ element = $ this ->getMockElement (false );
3333 $ this ->jsonEncode ($ element );
3434 }
3535
36- public function testCanSetParentWithFluidInterfaceAndGetParentBack ()
36+ public function testCanSetParentWithFluidInterfaceAndGetParentBack (): void
3737 {
3838 $ parent = $ this ->getMockElement ();
3939 $ element = $ this ->getMockElement ();
@@ -42,14 +42,14 @@ public function testCanSetParentWithFluidInterfaceAndGetParentBack()
4242 $ this ->assertSame ($ parent , $ element ->getParent ());
4343 }
4444
45- public function testCanUseNewAsFactoryForChildClasses ()
45+ public function testCanUseNewAsFactoryForChildClasses (): void
4646 {
4747 $ element = Section::new ();
4848 $ this ->assertEquals (Type::SECTION , $ element ->getType ());
4949 $ this ->assertInstanceOf (Section::class, $ element );
5050 }
5151
52- public function testCanSetExtraFieldsForArbitraryData ()
52+ public function testCanSetExtraFieldsForArbitraryData (): void
5353 {
5454 $ element = $ this ->getMockElement ();
5555
@@ -62,7 +62,7 @@ public function testCanSetExtraFieldsForArbitraryData()
6262 ]);
6363 }
6464
65- public function testCanTapIntoElementForChaining ()
65+ public function testCanTapIntoElementForChaining (): void
6666 {
6767 $ element = $ this ->getMockElement ()->tap (function (Element $ e ) {
6868 $ e ->setExtra ('fizz ' , 'buzz ' );
@@ -76,7 +76,7 @@ public function testCanTapIntoElementForChaining()
7676 ]);
7777 }
7878
79- public function testCanConditionallyTapIntoElementForChaining ()
79+ public function testCanConditionallyTapIntoElementForChaining (): void
8080 {
8181 $ callable = function (Element $ e ) {
8282 $ e ->setExtra ('fizz ' , 'buzz ' );
@@ -100,8 +100,8 @@ public function testCanConditionallyTapIntoElementForChaining()
100100 private function getMockElement (bool $ valid = true ): Element
101101 {
102102 return new class ($ valid ) extends Element {
103- private $ text ;
104- private $ valid ;
103+ private string $ text ;
104+ private bool $ valid ;
105105
106106 public function __construct (bool $ valid )
107107 {
@@ -128,7 +128,7 @@ public function toArray(): array
128128 };
129129 }
130130
131- public function testHydration ()
131+ public function testHydration (): void
132132 {
133133 $ beforeJson = <<<JSON
134134 {
@@ -180,13 +180,13 @@ public function testHydration()
180180 $ this ->assertJsonStringEqualsJsonString ($ beforeJson , $ afterJson );
181181 }
182182
183- public function testFromJsonThrowsExceptionOnBadJson ()
183+ public function testFromJsonThrowsExceptionOnBadJson (): void
184184 {
185185 $ this ->expectException (HydrationException::class);
186186 Modal::fromJson ('{"foo":"Bar",} ' );
187187 }
188188
189- public function testCanExportToJsonWithPrettyPrint ()
189+ public function testCanExportToJsonWithPrettyPrint (): void
190190 {
191191 $ element = $ this ->getMockElement ();
192192 $ json = $ element ->toJson (true );
0 commit comments