Skip to content

Commit 0cc1b71

Browse files
Use #[AsCommand] to describe commands
1 parent a168d2d commit 0cc1b71

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Command/LintCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Yaml\Command;
1313

1414
use Symfony\Component\Console\CI\GithubActionReporter;
15+
use Symfony\Component\Console\Attribute\AsCommand;
1516
use Symfony\Component\Console\Command\Command;
1617
use Symfony\Component\Console\Exception\InvalidArgumentException;
1718
use Symfony\Component\Console\Exception\RuntimeException;
@@ -30,11 +31,9 @@
3031
* @author Grégoire Pineau <[email protected]>
3132
* @author Robin Chalas <[email protected]>
3233
*/
34+
#[AsCommand(name: 'lint:yaml', description: 'Lint a YAML file and outputs encountered errors')]
3335
class LintCommand extends Command
3436
{
35-
protected static $defaultName = 'lint:yaml';
36-
protected static $defaultDescription = 'Lint a YAML file and outputs encountered errors';
37-
3837
private Parser $parser;
3938
private ?string $format = null;
4039
private bool $displayCorrectFiles;
@@ -55,7 +54,6 @@ public function __construct(string $name = null, callable $directoryIteratorProv
5554
protected function configure()
5655
{
5756
$this
58-
->setDescription(self::$defaultDescription)
5957
->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN')
6058
->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format')
6159
->addOption('exclude', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Path(s) to exclude')

0 commit comments

Comments
 (0)