Skip to content

Commit ce43530

Browse files
committed
Add AsCommand attribute
1 parent b8e1616 commit ce43530

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Command/IncrementCommand.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,21 @@
1212
use Bizkit\VersioningBundle\VCS\VCSHandlerInterface;
1313
use Bizkit\VersioningBundle\Version;
1414
use Bizkit\VersioningBundle\Writer\WriterInterface;
15+
use Symfony\Component\Console\Attribute\AsCommand;
1516
use Symfony\Component\Console\Command\Command;
1617
use Symfony\Component\Console\Input\InputInterface;
1718
use Symfony\Component\Console\Output\OutputInterface;
1819
use Symfony\Component\Console\Style\StyleInterface;
1920
use Symfony\Component\Console\Style\SymfonyStyle;
2021

22+
#[AsCommand(self::DEFAULT_NAME, self::DEFAULT_DESCRIPTION)]
2123
final class IncrementCommand extends Command
2224
{
23-
protected static $defaultName = 'bizkit:versioning:increment';
24-
protected static $defaultDescription = 'Increments the version using the configured versioning strategy.';
25+
public const DEFAULT_NAME = 'bizkit:versioning:increment';
26+
public const DEFAULT_DESCRIPTION = 'Increments the version using the configured versioning strategy.';
27+
28+
protected static $defaultName = self::DEFAULT_NAME;
29+
protected static $defaultDescription = self::DEFAULT_DESCRIPTION;
2530

2631
/**
2732
* @var string
@@ -66,7 +71,7 @@ public function __construct(
6671

6772
protected function configure(): void
6873
{
69-
$this->setDescription(self::$defaultDescription);
74+
$this->setDescription(self::DEFAULT_DESCRIPTION);
7075
}
7176

7277
protected function execute(InputInterface $input, OutputInterface $output): int

0 commit comments

Comments
 (0)