@@ -119,7 +119,7 @@ public function testRunClosureRoute(): void
119119
120120 // Inject mock router.
121121 $ routes = service ('routes ' );
122- $ routes ->add ('pages/(:segment) ' , static function ($ segment ): void {
122+ $ routes ->add ('pages/(:segment) ' , static function (string $ segment = '' ): void {
123123 echo 'You want to see " ' . esc ($ segment ) . '" page. ' ;
124124 });
125125 $ router = service ('router ' , $ routes , service ('incomingrequest ' ));
@@ -231,7 +231,7 @@ public function testControllersCanReturnString(): void
231231 $ routes = service ('routes ' );
232232 $ routes ->add (
233233 'pages/(:segment) ' ,
234- static fn ($ segment ): string => 'You want to see " ' . esc ($ segment ) . '" page. ' ,
234+ static fn (string $ segment = '' ): string => 'You want to see " ' . esc ($ segment ) . '" page. ' ,
235235 );
236236 $ router = service ('router ' , $ routes , service ('incomingrequest ' ));
237237 Services ::injectMock ('router ' , $ router );
@@ -253,12 +253,10 @@ public function testControllersCanReturnResponseObject(): void
253253
254254 // Inject mock router.
255255 $ routes = service ('routes ' );
256- $ routes ->add ('pages/(:segment) ' , static function ($ segment ) {
257- $ response = service ('response ' );
258- $ string = "You want to see 'about' page. " ;
259-
260- return $ response ->setBody ($ string );
261- });
256+ $ routes ->add (
257+ 'pages/(:segment) ' ,
258+ static fn () => service ('response ' )->setBody ("You want to see 'about' page. " ),
259+ );
262260 $ router = service ('router ' , $ routes , service ('incomingrequest ' ));
263261 Services ::injectMock ('router ' , $ router );
264262
@@ -282,11 +280,10 @@ public function testControllersCanReturnDownloadResponseObject(): void
282280
283281 // Inject mock router.
284282 $ routes = service ('routes ' );
285- $ routes ->add ('pages/(:segment) ' , static function ($ segment ) {
286- $ response = service ('response ' );
287-
288- return $ response ->download ('some.txt ' , 'some text ' , true );
289- });
283+ $ routes ->add (
284+ 'pages/(:segment) ' ,
285+ static fn () => service ('response ' )->download ('some.txt ' , 'some text ' , true ),
286+ );
290287 $ router = service ('router ' , $ routes , service ('incomingrequest ' ));
291288 Services ::injectMock ('router ' , $ router );
292289
0 commit comments