Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Reintroduce ::class Constants for Framework Controllers in Router (Reimplements #54134) #54189

Conversation

SanderMuller
Copy link
Contributor

@SanderMuller SanderMuller commented Jan 14, 2025

This PR reimplements #54134, which was reverted in #54185 due to a breaking change. A regression test has since been added, ensuring the change can be safely reintroduced.

Key Changes:

  • Replaces string-based references to framework controllers with ::class constants for better type safety and maintainability.
  • Adds isFrameworkController() and getFrameworkControllers() methods to centralize framework controller handling.
  • Updates prependGroupNamespace() to respect framework controllers and avoid unnecessary namespace prefixing.

This reimplementation leverages the regression test to address previous concerns while improving code consistency and developer experience.

@@ -249,10 +249,7 @@ protected function isVendorRoute(Route $route)
*/
protected function isFrameworkController(Route $route)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could probably drop this method and just use $this->router->isFrameworkController((string) $route->getControllerClass()) directly, but I didn't want to introduce this potential breaking change since it's a protected method in a non final class

@taylorotwell
Copy link
Member

I'm not sure what we're actually solving for here. I think it's fine. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants