logo
podcast Podcast
get help Get Unstuck

Stripping down a new command

And why I do it

Joel Clermont
Joel Clermont
2025-01-31

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.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼
email
No spam. Only real-world advice you can use.