DEV Community

Morcos Gad
Morcos Gad

Posted on

Removing return types in the controller - Laravel 10.1 Released

It was released Laravel 10.1 after the official release of what I consider to be an important fix and update, as well as other things, but we will focus on Removing return types

  • Removing return types in the controller stubs

The Laravel 10 major release included return types in userland code, including controller stubs. However, this caused some confusion as Laravel controllers can return various types of data (i.e., array, string, View, etc.).

Pull Request #46166 aimed to return mixed type to avoid errors in generated controllers but still provide types. Eventually, pull request #46166 was updated to remove all return types from controllers. No matter what side of the fence you are on, there are plenty of options for you to customize stubs if you wish native return types in generated controllers.

See Customizing Stubs in Laravel if you want to learn more about adapting controller stubs to your preference.

Here the topic is well covered
https://www.youtube.com/watch?v=daaT9HvotPU

Visit the resources to dig deeper.
https://laravel-news.com/laravel-10-1-0

Top comments (1)

Collapse
 
igulzaib profile image
Gul Zaib

That's good news Morcos