

Discover more from Laravel News Substack
One of the new features in Laravel 10 is all the skeletons come with native-type declarations. If you run php artisan make:controller Account --resource
then the out output looks like this:
The problem occurs because it defaults to a Response
return type. So this means returning a view, a string, an array, or literally anything other than a Response
to fail.
Of course, this is an easy fix and you can just change the method's return type after the stub is generated, but honestly, that doesn't feel very Laravel-like.
One of the nice things about the framework is that it always considers the people new to it and new to PHP in general. This felt backward to that.
There ended up being quite a bit of discussion on a GitHub PR around what should be done here, with suggestions ranging from using mixed
to a new interface and everything in between.
At the end of the day, Taylor decided the prudent step forward is removing the Controller stubs' return types. Which, in my opinion, is the right call.