1212use phpDocumentor \Reflection \Fqsen ;
1313use phpDocumentor \Reflection \Location ;
1414use phpDocumentor \Reflection \Php \Argument ;
15+ use phpDocumentor \Reflection \Php \Expression ;
1516use phpDocumentor \Reflection \Php \Method ;
1617use phpDocumentor \Reflection \Php \ProjectFactory ;
1718use phpDocumentor \Reflection \Php \Project ;
2829 */
2930class ConstructorPromotionTest extends TestCase
3031{
31- const FILE = __DIR__ . '/../data/PHP8/ConstructorPromotion.php ' ;
32- /** @var ProjectFactory */
33- private $ fixture ;
32+ private const FILE = __DIR__ . '/../data/PHP8/ConstructorPromotion.php ' ;
3433
35- /** @var Project */
36- private $ project ;
34+ private ProjectFactory $ fixture ;
35+ private Project $ project ;
3736
3837 protected function setUp () : void
3938 {
@@ -55,17 +54,13 @@ public function testPropertiesAreCreated() : void
5554 $ constructor ->addArgument (new Argument ('name ' , new String_ ()));
5655 $ constructor ->addArgument (new Argument ('email ' , new String_ (), '\'test@example.com \'' ));
5756 $ constructor ->addArgument (new Argument ('birth_date ' , new Object_ (new Fqsen ('\\' . DateTimeImmutable::class))));
58- $ constructor ->addArgument (new Argument ('created_at ' , new Object_ (new Fqsen ('\\' . DateTimeImmutable::class))));
59- $ constructor ->addArgument (new Argument ('uses_constants ' , new Array_ ()));
6057
6158 self ::assertEquals ($ constructor , $ class ->getMethods ()['\PHP8\ConstructorPromotion::__construct() ' ]);
6259 self ::assertEquals (
6360 [
6461 '\PHP8\ConstructorPromotion::$name ' => $ this ->expectedNameProperty (),
6562 '\PHP8\ConstructorPromotion::$email ' => $ this ->expectedEmailProperty (),
6663 '\PHP8\ConstructorPromotion::$birth_date ' => $ this ->expectedBirthDateProperty (),
67- '\PHP8\ConstructorPromotion::$created_at ' => $ this ->expectedCreatedAtProperty (),
68- '\PHP8\ConstructorPromotion::$uses_constants ' => $ this ->expectedUsesConstantsProperty (),
6964 ],
7065 $ class ->getProperties ()
7166 );
@@ -92,14 +87,14 @@ private function expectedConstructorMethod(): Method
9287 false ,
9388 false ,
9489 false ,
95- new Location (18 , 218 ),
96- new Location (31 , 522 )
90+ new Location (18 , 264 ),
91+ new Location (29 , 568 )
9792 );
9893 }
9994
10095 private function expectedNameProperty (): Property
10196 {
102- $ name = new Property (
97+ return new Property (
10398 new Fqsen ('\PHP8\ConstructorPromotion::$name ' ),
10499 new Visibility (Visibility::PUBLIC_ ),
105100 new DocBlock (
@@ -112,68 +107,37 @@ private function expectedNameProperty(): Property
112107 ),
113108 null ,
114109 false ,
115- new Location (24 ),
116- new Location (24 ),
110+ new Location (26 ),
111+ new Location (26 ),
117112 new String_ ()
118113 );
119- return $ name ;
120114 }
121115
122116 private function expectedEmailProperty (): Property
123117 {
124- $ email = new Property (
118+ return new Property (
125119 new Fqsen ('\PHP8\ConstructorPromotion::$email ' ),
126120 new Visibility (Visibility::PROTECTED_ ),
127121 null ,
128122 '\'test@example.com \'' ,
129123 false ,
130- new Location (25 ),
131- new Location (25 ),
124+ new Location (27 ),
125+ new Location (27 ),
132126 new String_ ()
133127 );
134- return $ email ;
135128 }
136129
137130 private function expectedBirthDateProperty (): Property
138- {
139- $ birthDate = new Property (
140- new Fqsen ('\PHP8\ConstructorPromotion::$birth_date ' ),
141- new Visibility (Visibility::PRIVATE_ ),
142- null ,
143- null ,
144- false ,
145- new Location (26 ),
146- new Location (26 ),
147- new Object_ (new Fqsen ('\\' . DateTimeImmutable::class))
148- );
149- return $ birthDate ;
150- }
151-
152- private function expectedCreatedAtProperty (): Property
153131 {
154132 return new Property (
155- new Fqsen ('\PHP8\ConstructorPromotion::$created_at ' ),
133+ new Fqsen ('\PHP8\ConstructorPromotion::$birth_date ' ),
156134 new Visibility (Visibility::PRIVATE_ ),
157135 null ,
158136 null ,
159137 false ,
160- new Location (26 ),
161- new Location (26 ),
138+ new Location (28 ),
139+ new Location (28 ),
162140 new Object_ (new Fqsen ('\\' . DateTimeImmutable::class))
163141 );
164142 }
165-
166- private function expectedUsesConstantsProperty (): Property
167- {
168- return new Property (
169- new Fqsen ('\PHP8\ConstructorPromotion::$uses_constants ' ),
170- new Visibility (Visibility::PRIVATE_ ),
171- null ,
172- null ,
173- false ,
174- new Location (26 ),
175- new Location (26 ),
176- new Array_ ()
177- );
178- }
179143}
0 commit comments