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

[9.x] Allow set command description via AsCommand attribute #45117

Merged

Conversation

dinhquochan
Copy link
Contributor

@dinhquochan dinhquochan commented Nov 28, 2022

Currently, if we use the AsCommand attribute, it will not be set to $description of the class, because Laravel command overrides this property.

This PR will allow us to use AsCommand to set the description of the command class.

ExampleCommand.php using AsCommand:

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand('example', 'This is an example command')]
class ExampleCommand extends Command
{
    // 
}

Before the PR

image

After the PR

image

Thanks.

@dinhquochan dinhquochan changed the title [9.x] Allows set command description via AsCommand attribute [9.x] Allow set command description via AsCommand attribute Nov 28, 2022
@laravel laravel deleted a comment from xuandung38 Nov 28, 2022
@laravel laravel deleted a comment from huynt57 Nov 28, 2022
@laravel laravel deleted a comment from datlechin Nov 28, 2022
@driesvints
Copy link
Member

Please keep the conversation on-topic and use the 👍 if you like the PR.

@taylorotwell taylorotwell merged commit 15e1a54 into laravel:9.x Nov 28, 2022
@dinhquochan dinhquochan deleted the dinhquochan-support-as-command branch November 28, 2022 15:15
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.

None yet

3 participants