Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Update console.stub to make new commands lazy by default #53390

Closed
wants to merge 1 commit into from

Conversation

onlime
Copy link
Contributor

@onlime onlime commented Nov 3, 2024

The AsCommand attribute was introduced quite some time ago (March 2024) in most or even all framework Artisan commands. For some examples, see:

So I guess it's time that this is also added to console.stub to motivate everyone to make commands lazy by default when using php artisan make:command.

Short explanation of what this magic AsCommand attribute does:

Applying the attribute allows us to not instantiate a command when running a different command.

@henzeb
Copy link
Contributor

henzeb commented Nov 3, 2024

Not a big fan of the current interpretation of those attributes. They should be used sparingly. Like override or deprecated. We can define commands differently. But then again, I am not using artisan make commands.

@onlime
Copy link
Contributor Author

onlime commented Nov 3, 2024

@henzeb

Not a big fan of the current interpretation of those attributes. They should be used sparingly. Like override or deprecated. We can define commands differently. But then again, I am not using artisan make commands.

What do you mean by "should be used sparingly"? We don't need to be fan of everything. If this is the current recommended way of the framework to make commands lazy, we should also use that attribute for all of our custom Artisan commands in our own projects. If you know a better way of doing it, please PR to the framework. Very much interested in your solution!

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants