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

[10x] Allow calling getControllerClass on closure-based routes #46411

Merged

Conversation

jnoordsij
Copy link
Contributor

Follow-up to #46332.

Currently calling getControllerClass on any Route is allowed, but throws an exception TypeError: str_contains(): Argument #1 ($haystack) must be of type string, Closure given whenever the route is closure based. This makes checking a route collection for routes using a specific controller quite hard.

This PR adds a fallback value of null for these cases, which is much easier to handle than the exception.

@taylorotwell taylorotwell merged commit 8c3a23d into laravel:10.x Mar 10, 2023
@jnoordsij jnoordsij deleted the route-controller-class-on-closures branch March 10, 2023 14:49
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