@@ -46,7 +46,7 @@ public function testToString($decl, $result)
4646 {
4747 $ this ->assertEquals ($ decl , (string ) $ result );
4848 }
49-
49+
5050 public function testHasSubTypes ()
5151 {
5252 $ this ->assertFalse ((new Type (Type::TYPE_LONG ))->hasSubTypes ());
@@ -67,7 +67,7 @@ public static function provideTestAllowsNull()
6767 Helper::union (Helper::int (), Helper::null (), Helper::string ()),
6868 Helper::union (Helper::int (), Helper::null ())
6969 ), false ];
70- }
70+ }
7171
7272 #[DataProvider("provideTestAllowsNull " )]
7373 public function testAllowsNull (Type $ type , $ isAllowed )
@@ -86,28 +86,42 @@ public static function provideTestSimplification()
8686 yield ["empty intersection " , new Type (Type::TYPE_INTERSECTION , []), Helper::void ()];
8787
8888 // Nested same complex types
89- yield ["nested same union " , new Type (Type::TYPE_UNION , [
90- new Type (Type::TYPE_UNION , [Helper::int ()])
91- ]), Helper::int ()];
92- yield ["nested same intersection " , new Type (Type::TYPE_INTERSECTION , [
93- new Type (Type::TYPE_INTERSECTION , [Helper::int ()])
94- ]), Helper::int ()];
89+ yield [
90+ "nested same union " ,
91+ new Type (Type::TYPE_UNION , [
92+ new Type (Type::TYPE_UNION , [Helper::int ()]),
93+ ]),
94+ Helper::int (),
95+ ];
96+ yield [
97+ "nested same intersection " ,
98+ new Type (Type::TYPE_INTERSECTION , [
99+ new Type (Type::TYPE_INTERSECTION , [Helper::int ()]),
100+ ]),
101+ Helper::int (),
102+ ];
95103
96104 // Nested different complex types
97- yield ["nested intersection unions " , new Type (Type::TYPE_UNION , [
98- new Type (Type::TYPE_INTERSECTION , [Helper::int (), Helper::float ()]),
99- new Type (Type::TYPE_INTERSECTION , [Helper::string (), Helper::float ()])
100- ]), Helper::union (
101- Helper::intersection (Helper::int (), Helper::float ()),
102- Helper::intersection (Helper::string (), Helper::float ())
103- )];
105+ yield [
106+ "nested intersection unions " ,
107+ new Type (Type::TYPE_UNION , [
108+ new Type (Type::TYPE_INTERSECTION , [Helper::int (), Helper::float ()]),
109+ new Type (Type::TYPE_INTERSECTION , [Helper::string (), Helper::float ()]),
110+ ]),
111+ Helper::union (
112+ Helper::intersection (Helper::int (), Helper::float ()),
113+ Helper::intersection (Helper::string (), Helper::float ())
114+ ),
115+ ];
104116
105117 // Nested same complex types. Tests elimination of duplicated types
106- yield ["nested intersection unions " , new Type (Type::TYPE_UNION , [
118+ yield [
119+ "nested intersection unions " ,
120+ new Type (Type::TYPE_UNION , [
107121 new Type (Type::TYPE_INTERSECTION , [Helper::int (), Helper::float ()]),
108- new Type (Type::TYPE_INTERSECTION , [Helper::int (), Helper::float ()])
109- ]),
110- Helper::intersection (Helper::int (), Helper::float ())
122+ new Type (Type::TYPE_INTERSECTION , [Helper::int (), Helper::float ()]),
123+ ]),
124+ Helper::intersection (Helper::int (), Helper::float ()),
111125 ];
112126 }
113127
0 commit comments