Skip to content

Commit eda7d42

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

33 files changed

+95
-79
lines changed

src/Symfony/Bridge/Twig/Command/DebugCommand.php

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

3133
/**
@@ -66,7 +68,6 @@ protected function getTwigEnvironment()
6668
protected function configure()
6769
{
6870
$this
69-
->setName('debug:twig')
7071
->setDefinition(array(
7172
new InputArgument('filter', InputArgument::OPTIONAL, 'Show details for all entries matching this filter'),
7273
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (text or json)', 'text'),

src/Symfony/Bridge/Twig/Command/LintCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
*/
3232
class LintCommand extends Command
3333
{
34+
protected static $defaultName = 'lint:twig';
35+
3436
private $twig;
3537

3638
/**
@@ -71,7 +73,6 @@ protected function getTwigEnvironment()
7173
protected function configure()
7274
{
7375
$this
74-
->setName('lint:twig')
7576
->setDescription('Lints a template and outputs encountered errors')
7677
->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt')
7778
->addArgument('filename', InputArgument::IS_ARRAY)

src/Symfony/Bridge/Twig/composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@
3333
"symfony/security": "~2.8|~3.0|~4.0",
3434
"symfony/security-acl": "~2.8|~3.0",
3535
"symfony/stopwatch": "~2.8|~3.0|~4.0",
36-
"symfony/console": "~2.8|~3.0|~4.0",
36+
"symfony/console": "~3.4|~4.0",
3737
"symfony/var-dumper": "~2.8.10|~3.1.4|~3.2|~4.0",
3838
"symfony/expression-language": "~2.8|~3.0|~4.0",
3939
"symfony/web-link": "~3.3|~4.0"
4040
},
4141
"conflict": {
42-
"symfony/form": "<3.2.10|~3.3,<3.3.3"
42+
"symfony/form": "<3.2.10|~3.3,<3.3.3",
43+
"symfony/console": "<3.4"
4344
},
4445
"suggest": {
4546
"symfony/finder": "",

src/Symfony/Bundle/FrameworkBundle/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
/**

src/Symfony/Bundle/FrameworkBundle/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
))

src/Symfony/Bundle/FrameworkBundle/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)'),

src/Symfony/Bundle/FrameworkBundle/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
))

src/Symfony/Bundle/FrameworkBundle/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.

src/Symfony/Bundle/FrameworkBundle/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
))

src/Symfony/Bundle/FrameworkBundle/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'),

0 commit comments

Comments
 (0)