Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 67abb80

Browse filesBrowse files
committed
feature #23887 [Console] Allow commands to provide a default name for compile time registration (chalasr, nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [Console] Allow commands to provide a default name for compile time registration | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #23796 | License | MIT | Doc PR | symfony/symfony-docs#8147 Commits ------- eda7d42 [Console] Add protected static $defaultName to set the default name of a Command 5d9ae6b [Console] Allow commands to provide a default name for compile time registration
2 parents 481e31c + eda7d42 commit 67abb80
Copy full SHA for 67abb80
Expand file treeCollapse file tree

32 files changed

+130
-45
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Command/DebugCommand.php
+2-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Command/LintCommand.php
+2-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/composer.json
+3-2Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php
+3-4Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php
+2-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
*/
3333
class CacheClearCommand extends ContainerAwareCommand
3434
{
35+
protected static $defaultName = 'cache:clear';
36+
3537
private $cacheClearer;
3638
private $filesystem;
3739
private $warning;
@@ -62,7 +64,6 @@ public function __construct($cacheClearer = null, Filesystem $filesystem = null)
6264
protected function configure()
6365
{
6466
$this
65-
->setName('cache:clear')
6667
->setDefinition(array(
6768
new InputOption('no-warmup', '', InputOption::VALUE_NONE, 'Do not warm up the cache'),
6869
new InputOption('no-optional-warmers', '', InputOption::VALUE_NONE, 'Skip optional cache warmers (faster)'),

‎src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/CachePoolClearCommand.php
+2-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/CachePoolPruneCommand.php
+2-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/CacheWarmupCommand.php
+2-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php
+2-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.