Skip to content

Commit 10fb048

Browse files
committed
ISSUE-345: deprecation fix
1 parent dadaded commit 10fb048

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/Domain/Messaging/Command/SendTestEmailCommand.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@
66

77
use Exception;
88
use PhpList\Core\Domain\Messaging\Service\EmailService;
9+
use Symfony\Component\Console\Attribute\AsCommand;
910
use Symfony\Component\Console\Command\Command;
1011
use Symfony\Component\Console\Input\InputArgument;
1112
use Symfony\Component\Console\Input\InputInterface;
1213
use Symfony\Component\Console\Output\OutputInterface;
1314
use Symfony\Component\Mime\Address;
1415
use Symfony\Component\Mime\Email;
1516

17+
#[AsCommand(
18+
name: 'phplist:test-email',
19+
description: 'Send a test email to verify email configuration'
20+
)]
1621
class SendTestEmailCommand extends Command
1722
{
18-
protected static $defaultName = 'phplist:test-email';
19-
protected static $defaultDescription = 'Send a test email to verify email configuration';
20-
2123
private EmailService $emailService;
2224

2325
public function __construct(EmailService $emailService)
@@ -29,9 +31,17 @@ public function __construct(EmailService $emailService)
2931
protected function configure(): void
3032
{
3133
$this
32-
->setDescription(self::$defaultDescription)
33-
->addArgument('recipient', InputArgument::OPTIONAL, 'Recipient email address')
34-
->addOption('sync', null, InputArgument::OPTIONAL, 'Send email synchronously instead of queuing it', false);
34+
->addArgument(
35+
name: 'recipient',
36+
mode: InputArgument::OPTIONAL,
37+
description: 'Recipient email address'
38+
)
39+
->addOption(
40+
name: 'sync',
41+
mode: InputArgument::OPTIONAL,
42+
description: 'Send email synchronously instead of queuing it',
43+
default: false
44+
);
3545
}
3646

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

0 commit comments

Comments
 (0)