File tree Expand file tree Collapse file tree 3 files changed +5
-2
lines changed
system/Commands/Utilities Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 1111
1212namespace CodeIgniter \Commands \Utilities ;
1313
14+ use Closure ;
1415use CodeIgniter \CLI \BaseCommand ;
1516use CodeIgniter \CLI \CLI ;
1617use CodeIgniter \Commands \Utilities \Routes \AutoRouteCollector ;
@@ -92,11 +93,11 @@ public function run(array $params)
9293
9394 foreach ($ routes as $ route => $ handler ) {
9495 // filter for strings, as callbacks aren't displayable
95- if (is_string ($ handler )) {
96+ if (is_string ($ handler ) || $ handler instanceof Closure ) {
9697 $ tbody [] = [
9798 strtoupper ($ method ),
9899 $ route ,
99- $ handler ,
100+ is_string ( $ handler) ? $ handler : ' (Closure) ' ,
100101 ];
101102 }
102103 }
Original file line number Diff line number Diff line change 1313
1414// This is a simple file to include for testing the RouteCollection class.
1515$ routes ->add ('testing ' , 'TestController::index ' , ['as ' => 'testing-index ' ]);
16+ $ routes ->get ('closure ' , static fn () => 'closure test ' );
Original file line number Diff line number Diff line change @@ -110,6 +110,7 @@ public function testRoutesCommand()
110110 {
111111 command ('routes ' );
112112
113+ $ this ->assertStringContainsString ('| (Closure) ' , $ this ->getBuffer ());
113114 $ this ->assertStringContainsString ('| Route ' , $ this ->getBuffer ());
114115 $ this ->assertStringContainsString ('| testing ' , $ this ->getBuffer ());
115116 $ this ->assertStringContainsString ('\\TestController::index ' , $ this ->getBuffer ());
You can’t perform that action at this time.
0 commit comments