Skip to content

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

Merged
taylorotwell merged 1 commit into
laravel:9.xfrom
dinhquochan:dinhquochan-support-as-command
Nov 28, 2022
Merged

[9.x] Allow set command description via AsCommand attribute#45117
taylorotwell merged 1 commit into
laravel:9.xfrom
dinhquochan:dinhquochan-support-as-command

Conversation

@dinhquochan
Copy link
Copy Markdown
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
Copy Markdown
Member

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

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