Black Friday: the Laravel testing course is $149 instead of $249, through Dec 7. See the course →
logo

Stripping down a new command

And why I do it

Joel Clermont
Joel Clermont
2025-01-31

From our daily Laravel tips email. Get the next one in your inbox.

The first thing I do after using artisan make to scaffold a new command is to remove all the docblocks from the generated file. (Yes, I could customize the stubs, but I don't want to have to keep them up to date with Laravel updates.)

I already know what handle() does, so I don't need the explanation.

But what about the signature and description properties? Do I trim out the description, but leave the docblocks which also had types?

As much as I love types, I get rid of those too. These protected properties are only ever used by the framework itself, so I don't need to enforce types there. It's the same logic as why I don't include return types on controller actions.

I trust that Laravel knows what it is doing and has its own tests and type checks for these properties as needed.

This is a small thing, but it keeps my codebase clean and focused on what's important.

Here to help,

Joel

P.S. If you're a solo dev and don't have someone to do code review, I'd be happy to take a look. It's a really valuable process.

Want a tip like this in your inbox every weekday?

Each one takes less than 2 minutes to read. Join 4,000+ Laravel developers who already get them.

email
No spam. Only real-world advice.
Toss a coin in the jar if you found this helpful.