Skip to content

Commit e67bd53

Browse files
nicolas-grekaschalasr
authored andcommitted
[Console] Add protected static $defaultName to set the default name of a Command
1 parent 4d22b24 commit e67bd53

17 files changed

+33
-18
lines changed

Command/AboutCommand.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@
2828
*/
2929
class AboutCommand extends ContainerAwareCommand
3030
{
31+
protected static $defaultName = 'about';
32+
3133
/**
3234
* {@inheritdoc}
3335
*/
3436
protected function configure()
3537
{
36-
$this
37-
->setName('about')
38-
->setDescription('Displays information about the current project')
39-
;
38+
$this->setDescription('Displays information about the current project');
4039
}
4140

4241
/**

Command/AssetsInstallCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class AssetsInstallCommand extends ContainerAwareCommand
3535
const METHOD_ABSOLUTE_SYMLINK = 'absolute symlink';
3636
const METHOD_RELATIVE_SYMLINK = 'relative symlink';
3737

38+
protected static $defaultName = 'assets:install';
39+
3840
private $filesystem;
3941

4042
/**
@@ -61,7 +63,6 @@ public function __construct($filesystem = null)
6163
protected function configure()
6264
{
6365
$this
64-
->setName('assets:install')
6566
->setDefinition(array(
6667
new InputArgument('target', InputArgument::OPTIONAL, 'The target directory', 'public'),
6768
))

Command/CacheClearCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
*/
3232
class CacheClearCommand extends ContainerAwareCommand
3333
{
34+
protected static $defaultName = 'cache:clear';
35+
3436
private $cacheClearer;
3537
private $filesystem;
3638

@@ -60,7 +62,6 @@ public function __construct($cacheClearer = null, Filesystem $filesystem = null)
6062
protected function configure()
6163
{
6264
$this
63-
->setName('cache:clear')
6465
->setDefinition(array(
6566
new InputOption('no-warmup', '', InputOption::VALUE_NONE, 'Do not warm up the cache'),
6667
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),

Command/CachePoolClearCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
*/
2626
final class CachePoolClearCommand extends ContainerAwareCommand
2727
{
28+
protected static $defaultName = 'cache:pool:clear';
29+
2830
private $poolClearer;
2931

3032
/**
@@ -51,7 +53,6 @@ public function __construct($poolClearer = null)
5153
protected function configure()
5254
{
5355
$this
54-
->setName('cache:pool:clear')
5556
->setDefinition(array(
5657
new InputArgument('pools', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'A list of cache pools or cache pool clearers'),
5758
))

Command/CachePoolPruneCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*/
2525
final class CachePoolPruneCommand extends Command
2626
{
27+
protected static $defaultName = 'cache:pool:prune';
28+
2729
private $pools;
2830

2931
/**
@@ -42,7 +44,6 @@ public function __construct($pools)
4244
protected function configure()
4345
{
4446
$this
45-
->setName('cache:pool:prune')
4647
->setDescription('Prune cache pools')
4748
->setHelp(<<<'EOF'
4849
The <info>%command.name%</info> command deletes all expired items from all pruneable pools.

Command/CacheWarmupCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
*/
2727
class CacheWarmupCommand extends ContainerAwareCommand
2828
{
29+
protected static $defaultName = 'cache:warmup';
30+
2931
private $cacheWarmer;
3032

3133
/**
@@ -52,7 +54,6 @@ public function __construct($cacheWarmer = null)
5254
protected function configure()
5355
{
5456
$this
55-
->setName('cache:warmup')
5657
->setDefinition(array(
5758
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),
5859
))

Command/ConfigDebugCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@
2828
*/
2929
class ConfigDebugCommand extends AbstractConfigCommand
3030
{
31+
protected static $defaultName = 'debug:config';
32+
3133
/**
3234
* {@inheritdoc}
3335
*/
3436
protected function configure()
3537
{
3638
$this
37-
->setName('debug:config')
3839
->setDefinition(array(
3940
new InputArgument('name', InputArgument::OPTIONAL, 'The bundle name or the extension alias'),
4041
new InputArgument('path', InputArgument::OPTIONAL, 'The configuration option path'),

Command/ConfigDumpReferenceCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@
3030
*/
3131
class ConfigDumpReferenceCommand extends AbstractConfigCommand
3232
{
33+
protected static $defaultName = 'config:dump-reference';
34+
3335
/**
3436
* {@inheritdoc}
3537
*/
3638
protected function configure()
3739
{
3840
$this
39-
->setName('config:dump-reference')
4041
->setDefinition(array(
4142
new InputArgument('name', InputArgument::OPTIONAL, 'The Bundle name or the extension alias'),
4243
new InputArgument('path', InputArgument::OPTIONAL, 'The configuration option path'),

Command/ContainerDebugCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
*/
3333
class ContainerDebugCommand extends ContainerAwareCommand
3434
{
35+
protected static $defaultName = 'debug:container';
36+
3537
/**
3638
* @var ContainerBuilder|null
3739
*/
@@ -43,7 +45,6 @@ class ContainerDebugCommand extends ContainerAwareCommand
4345
protected function configure()
4446
{
4547
$this
46-
->setName('debug:container')
4748
->setDefinition(array(
4849
new InputArgument('name', InputArgument::OPTIONAL, 'A service name (foo)'),
4950
new InputOption('show-private', null, InputOption::VALUE_NONE, 'Used to show public *and* private services'),

Command/EventDispatcherDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
*/
2929
class EventDispatcherDebugCommand extends ContainerAwareCommand
3030
{
31+
protected static $defaultName = 'debug:event-dispatcher';
3132
private $dispatcher;
3233

3334
/**
@@ -54,7 +55,6 @@ public function __construct($dispatcher = null)
5455
protected function configure()
5556
{
5657
$this
57-
->setName('debug:event-dispatcher')
5858
->setDefinition(array(
5959
new InputArgument('event', InputArgument::OPTIONAL, 'An event name'),
6060
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),

0 commit comments

Comments
 (0)