Skip to content

Commit 725292d

Browse files
committed
Use attributes in symfony commands instead of old "default*" fields
1 parent aae22c5 commit 725292d

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

src/Console/GetUpdatesCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@
1111
use Botasis\Runtime\Update\UpdateFactory;
1212
use Psr\Log\LoggerInterface;
1313
use Psr\Log\NullLogger;
14+
use Symfony\Component\Console\Attribute\AsCommand;
1415
use Symfony\Component\Console\Command\Command;
1516
use Symfony\Component\Console\Input\InputInterface;
1617
use Symfony\Component\Console\Input\InputOption;
1718
use Symfony\Component\Console\Output\OutputInterface;
1819
use Throwable;
1920

21+
#[AsCommand(name: 'botasis:telegram:updates', description: 'Get updates from the bot and process them')]
2022
final class GetUpdatesCommand extends Command
2123
{
22-
protected static $defaultName = 'botasis/telegram/updates';
23-
protected static $defaultDescription = 'Get updates from the bot and process them';
24-
2524
public function __construct(
2625
private readonly ClientInterface $client,
2726
private readonly Application $application,

src/Console/SetTelegramWebhookCommand.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Botasis\Client\Telegram\Client\ClientInterface;
88
use Botasis\Client\Telegram\Request\TelegramRequest;
99
use InvalidArgumentException;
10+
use Symfony\Component\Console\Attribute\AsCommand;
1011
use Symfony\Component\Console\Command\Command;
1112
use Symfony\Component\Console\Helper\QuestionHelper;
1213
use Symfony\Component\Console\Input\InputInterface;
@@ -17,11 +18,9 @@
1718
use function str_contains;
1819
use function str_starts_with;
1920

21+
#[AsCommand(name: 'botasis:telegram:set-webhook', description: 'Set TG webhook address')]
2022
final class SetTelegramWebhookCommand extends Command
2123
{
22-
protected static $defaultName = 'botasis/telegram/set-webhook';
23-
protected static $defaultDescription = 'Set TG webhook address';
24-
2524
public function __construct(
2625
private readonly ClientInterface $client,
2726
private readonly QuestionHelper $questionHelper,

0 commit comments

Comments
 (0)