Skip to content

Commit

Permalink
Fix breaking change - Revert "[11.x] Replace string class names with …
Browse files Browse the repository at this point in the history
…::class constants" (#54185)

* Revert "refactor from string class names to constant (#54134)"

This reverts commit aed6bbe.

* Add failing test for #54185
  • Loading branch information
SanderMuller authored Jan 14, 2025
1 parent f99942d commit a06a0dc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/Console/RouteListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ protected function isVendorRoute(Route $route)
protected function isFrameworkController(Route $route)
{
return in_array($route->getControllerClass(), [
\Illuminate\Routing\RedirectController::class,
\Illuminate\Routing\ViewController::class,
'\Illuminate\Routing\RedirectController',
'\Illuminate\Routing\ViewController',
], true);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public function fallback($action)
*/
public function redirect($uri, $destination, $status = 302)
{
return $this->any($uri, \Illuminate\Routing\RedirectController::class)
return $this->any($uri, '\Illuminate\Routing\RedirectController')
->defaults('destination', $destination)
->defaults('status', $status);
}
Expand Down Expand Up @@ -287,7 +287,7 @@ public function permanentRedirect($uri, $destination)
*/
public function view($uri, $view, $data = [], $status = 200, array $headers = [])
{
return $this->match(['GET', 'HEAD'], $uri, \Illuminate\Routing\ViewController::class)
return $this->match(['GET', 'HEAD'], $uri, '\Illuminate\Routing\ViewController')
->setDefaults([
'view' => $view,
'data' => $data,
Expand Down
9 changes: 9 additions & 0 deletions tests/Routing/RouteRegistrarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,15 @@ public function testCanRegisterGroupWithNamespace()
'App\Http\Controllers\UsersController@index',
$this->getRoute()->getAction()['uses']
);

$this->router->namespace('App\Http\Controllers')->group(function ($router) {
$router->redirect('users', '/');
});

$this->assertSame(
'\Illuminate\Routing\RedirectController@__invoke',
$this->getRoute()->getAction()['uses']
);
}

public function testCanRegisterGroupWithPrefix()
Expand Down

0 comments on commit a06a0dc

Please sign in to comment.