DEV Community

Morcos Gad
Morcos Gad

Posted on

1 1 1 1 1

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

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (1)

Collapse
 
igulzaib profile image
Gul Zaib

That's good news Morcos

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay