-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Add broader support for command "help" definition #59473
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,6 +100,10 @@ public function __construct(?string $name = null) | |
$this->setDescription(static::getDefaultDescription() ?? ''); | ||
} | ||
|
||
if ('' === $this->help && $attributes = (new \ReflectionClass(static::class))->getAttributes(AsCommand::class)) { | ||
$this->setHelp($attributes[0]->newInstance()->help ?? ''); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should either add addDefaultHelp or deprecate getDefaultName/Description to be consistent There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name and description static methods remain useful for lazy commands, but this approach is not necessary for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would you prefer adding a private static method for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Are they really? I miss a case where it cannot be found in the tag and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I think I missed the fact that the |
||
|
||
if (\is_callable($this)) { | ||
$this->code = new InvokableCommand($this, $this(...)); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.