1313use phpDocumentor \Reflection \Fqsen ;
1414use phpDocumentor \Reflection \Location ;
1515use phpDocumentor \Reflection \Php \Argument ;
16+ use phpDocumentor \Reflection \Php \Expression ;
1617use phpDocumentor \Reflection \Php \Method ;
1718use phpDocumentor \Reflection \Php \ProjectFactory ;
1819use phpDocumentor \Reflection \Php \Project ;
2930 */
3031class ConstructorPromotionTest extends TestCase
3132{
32- const FILE = __DIR__ . '/../data/PHP8/ConstructorPromotion.php ' ;
33- /** @var ProjectFactory */
34- private $ fixture ;
33+ private const FILE = __DIR__ . '/../data/PHP8/ConstructorPromotion.php ' ;
3534
36- /** @var Project */
37- private $ project ;
35+ private ProjectFactory $ fixture ;
36+ private Project $ project ;
3837
3938 protected function setUp () : void
4039 {
@@ -56,17 +55,13 @@ public function testPropertiesAreCreated() : void
5655 $ constructor ->addArgument (new Argument ('name ' , new String_ (), "'default name' " ));
5756 $ constructor ->addArgument (new Argument ('email ' , new Object_ (new Fqsen ('\\PHP8 \\Email ' ))));
5857 $ constructor ->addArgument (new Argument ('birth_date ' , new Object_ (new Fqsen ('\\' . DateTimeImmutable::class))));
59- $ constructor ->addArgument (new Argument ('created_at ' , new Object_ (new Fqsen ('\\' . DateTimeImmutable::class))));
60- $ constructor ->addArgument (new Argument ('uses_constants ' , new Array_ ()));
6158
6259 self ::assertEquals ($ constructor , $ class ->getMethods ()['\PHP8\ConstructorPromotion::__construct() ' ]);
6360 self ::assertEquals (
6461 [
6562 '\PHP8\ConstructorPromotion::$name ' => $ this ->expectedNameProperty (),
6663 '\PHP8\ConstructorPromotion::$email ' => $ this ->expectedEmailProperty (),
6764 '\PHP8\ConstructorPromotion::$birth_date ' => $ this ->expectedBirthDateProperty (),
68- '\PHP8\ConstructorPromotion::$created_at ' => $ this ->expectedCreatedAtProperty (),
69- '\PHP8\ConstructorPromotion::$uses_constants ' => $ this ->expectedUsesConstantsProperty (),
7065 ],
7166 $ class ->getProperties ()
7267 );
@@ -93,14 +88,14 @@ private function expectedConstructorMethod(): Method
9388 false ,
9489 false ,
9590 false ,
96- new Location (18 , 218 ),
97- new Location (31 , 522 )
91+ new Location (18 , 264 ),
92+ new Location (29 , 568 )
9893 );
9994 }
10095
10196 private function expectedNameProperty (): Property
10297 {
103- $ name = new Property (
98+ return new Property (
10499 new Fqsen ('\PHP8\ConstructorPromotion::$name ' ),
105100 new Visibility (Visibility::PUBLIC_ ),
106101 new DocBlock (
@@ -113,68 +108,37 @@ private function expectedNameProperty(): Property
113108 ),
114109 "'default name' " ,
115110 false ,
116- new Location (24 , 393 ),
117- new Location (24 , 428 ),
111+ new Location (26 , 393 ),
112+ new Location (26 , 428 ),
118113 new String_ ()
119114 );
120- return $ name ;
121115 }
122116
123117 private function expectedEmailProperty (): Property
124118 {
125- $ email = new Property (
119+ return new Property (
126120 new Fqsen ('\PHP8\ConstructorPromotion::$email ' ),
127121 new Visibility (Visibility::PROTECTED_ ),
128122 null ,
129123 null ,
130124 false ,
131- new Location (25 , 439 ),
132- new Location (25 , 460 ),
125+ new Location (27 , 439 ),
126+ new Location (27 , 460 ),
133127 new Object_ (new Fqsen ('\\PHP8 \\Email ' ))
134128 );
135- return $ email ;
136129 }
137130
138131 private function expectedBirthDateProperty (): Property
139- {
140- $ birthDate = new Property (
141- new Fqsen ('\PHP8\ConstructorPromotion::$birth_date ' ),
142- new Visibility (Visibility::PRIVATE_ ),
143- null ,
144- null ,
145- false ,
146- new Location (26 ),
147- new Location (26 ),
148- new Object_ (new Fqsen ('\\' . DateTimeImmutable::class))
149- );
150- return $ birthDate ;
151- }
152-
153- private function expectedCreatedAtProperty (): Property
154132 {
155133 return new Property (
156- new Fqsen ('\PHP8\ConstructorPromotion::$created_at ' ),
134+ new Fqsen ('\PHP8\ConstructorPromotion::$birth_date ' ),
157135 new Visibility (Visibility::PRIVATE_ ),
158136 null ,
159137 null ,
160138 false ,
161- new Location (26 ),
162- new Location (26 ),
139+ new Location (28 ),
140+ new Location (28 ),
163141 new Object_ (new Fqsen ('\\' . DateTimeImmutable::class))
164142 );
165143 }
166-
167- private function expectedUsesConstantsProperty (): Property
168- {
169- return new Property (
170- new Fqsen ('\PHP8\ConstructorPromotion::$uses_constants ' ),
171- new Visibility (Visibility::PRIVATE_ ),
172- null ,
173- null ,
174- false ,
175- new Location (26 ),
176- new Location (26 ),
177- new Array_ ()
178- );
179- }
180144}
0 commit comments