-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[5.2] Route with an Array as action being mistaken with closure. #12187
Comments
I also need this feature for a project I'm working on. I've got a [simple] solution written, and it works with 5.1. Should I submit a PR against this issue + back to branch 5.1? Or back to Master? |
a simples solution i found out temporarily was creating a helper function
then i would use like this
|
Just delete the default namespace group: https://github.com/laravel/laravel/blob/master/app/Providers/RouteServiceProvider.php#L40 Then you can use the Route::get('/', HomeController::class . '@index'); |
See also #11300 |
@acasar cant believe that all i had to do was just add '@' in the method.... it did it! |
i would like to set up routes like this
So i would get refactoring on my IDE to work properly
However by inspecting the Laravel source code i found out this line
On line 536 in Illuminate\Routing\Route@parseAction
As i see on the commentaries it is instead to receive a Closure instance... how ever the function is_callable() also returns true if it receives an array [ValidClassPath::class, ValidMethod] so it causes laravel to mistake the action with a Closure.
I feel it just need a fix on this parser... to check again it the action is really a closure or an array.
underlying the return code of the parser is
instead of
The text was updated successfully, but these errors were encountered: