Skip to content

Commit 8faca92

Browse files
Use #[AsCommand] to describe commands
1 parent f0f744c commit 8faca92

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Command/DebugCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Validator\Command;
1313

14+
use Symfony\Component\Console\Attribute\AsCommand;
1415
use Symfony\Component\Console\Command\Command;
1516
use Symfony\Component\Console\Helper\Dumper;
1617
use Symfony\Component\Console\Helper\Table;
@@ -30,11 +31,9 @@
3031
*
3132
* @author Loïc Frémont <[email protected]>
3233
*/
34+
#[AsCommand(name: 'debug:validator', description: 'Display validation constraints for classes')]
3335
class DebugCommand extends Command
3436
{
35-
protected static $defaultName = 'debug:validator';
36-
protected static $defaultDescription = 'Display validation constraints for classes';
37-
3837
private MetadataFactoryInterface $validator;
3938

4039
public function __construct(MetadataFactoryInterface $validator)
@@ -49,7 +48,6 @@ protected function configure()
4948
$this
5049
->addArgument('class', InputArgument::REQUIRED, 'A fully qualified class name or a path')
5150
->addOption('show-all', null, InputOption::VALUE_NONE, 'Show all classes even if they have no validation constraints')
52-
->setDescription(self::$defaultDescription)
5351
->setHelp(<<<'EOF'
5452
The <info>%command.name% 'App\Entity\Dummy'</info> command dumps the validators for the dummy class.
5553

0 commit comments

Comments
 (0)