diff --git a/templates/bake/Command/command.twig b/templates/bake/Command/command.twig index d649080d..3654c334 100644 --- a/templates/bake/Command/command.twig +++ b/templates/bake/Command/command.twig @@ -28,6 +28,16 @@ */ class {{ name }}Command extends Command { + /** + * Get the command description. + * + * @return string + */ + public static function getDescription(): string + { + return 'Command description here.'; + } + /** * Hook method for defining this command's option parser. * @@ -37,9 +47,8 @@ class {{ name }}Command extends Command */ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser { - $parser = parent::buildOptionParser($parser); - - return $parser; + return parent::buildOptionParser($parser) + ->setDescription(static::getDescription()); } /** diff --git a/tests/comparisons/Command/testBakePlugin.php b/tests/comparisons/Command/testBakePlugin.php index 94f17b9c..da518ce2 100644 --- a/tests/comparisons/Command/testBakePlugin.php +++ b/tests/comparisons/Command/testBakePlugin.php @@ -13,6 +13,16 @@ */ class ExampleCommand extends Command { + /** + * Get the command description. + * + * @return string + */ + public static function getDescription(): string + { + return 'Command description here.'; + } + /** * Hook method for defining this command's option parser. * @@ -22,9 +32,8 @@ class ExampleCommand extends Command */ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionParser { - $parser = parent::buildOptionParser($parser); - - return $parser; + return parent::buildOptionParser($parser) + ->setDescription(static::getDescription()); } /**