Skip to content

Commit bbe1e6e

Browse files
committed
Use #[AsCommand] attribute on commands
Fixes the following deprecations: ```json { "message": "Since symfony/console 6.1: Relying on the static property \"$defaultName\" for setting a command name is deprecated. Add the \"Symfony\\Component\\Console\\Attribute\\AsCommand\" attribute to the \"Enqueue\\Symfony\\Consumption\\ConfigurableConsumeCommand\" class instead.", "count": 1 }, { "message": "Since symfony/console 6.1: Relying on the static property \"$defaultName\" for setting a command name is deprecated. Add the \"Symfony\\Component\\Console\\Attribute\\AsCommand\" attribute to the \"Enqueue\\Symfony\\Client\\ConsumeCommand\" class instead.", "count": 1 }, { "message": "Since symfony/console 6.1: Relying on the static property \"$defaultName\" for setting a command name is deprecated. Add the \"Symfony\\Component\\Console\\Attribute\\AsCommand\" attribute to the \"Enqueue\\Symfony\\Client\\ProduceCommand\" class instead.", "count": 1 }, { "message": "Since symfony/console 6.1: Relying on the static property \"$defaultName\" for setting a command name is deprecated. Add the \"Symfony\\Component\\Console\\Attribute\\AsCommand\" attribute to the \"Enqueue\\Symfony\\Client\\SetupBrokerCommand\" class instead.", "count": 1 }, { "message": "Since symfony/console 6.1: Relying on the static property \"$defaultName\" for setting a command name is deprecated. Add the \"Symfony\\Component\\Console\\Attribute\\AsCommand\" attribute to the \"Enqueue\\Symfony\\Client\\RoutesCommand\" class instead.", "count": 1 }, ```
1 parent 6cd94e8 commit bbe1e6e

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

pkg/enqueue/Symfony/Client/ConsumeCommand.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@
1313
use Interop\Queue\Processor;
1414
use Psr\Container\ContainerInterface;
1515
use Psr\Container\NotFoundExceptionInterface;
16+
use Symfony\Component\Console\Attribute\AsCommand;
1617
use Symfony\Component\Console\Command\Command;
1718
use Symfony\Component\Console\Input\InputArgument;
1819
use Symfony\Component\Console\Input\InputInterface;
1920
use Symfony\Component\Console\Input\InputOption;
2021
use Symfony\Component\Console\Output\OutputInterface;
2122

23+
#[AsCommand('enqueue:consume')]
2224
class ConsumeCommand extends Command
2325
{
26+
use ChooseLoggerCommandTrait;
2427
use LimitsExtensionsCommandTrait;
25-
use SetupBrokerExtensionCommandTrait;
2628
use QueueConsumerOptionsCommandTrait;
27-
use ChooseLoggerCommandTrait;
29+
use SetupBrokerExtensionCommandTrait;
2830

2931
protected static $defaultName = 'enqueue:consume';
3032

pkg/enqueue/Symfony/Client/ProduceCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
use Enqueue\Client\ProducerInterface;
77
use Psr\Container\ContainerInterface;
88
use Psr\Container\NotFoundExceptionInterface;
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\Input\InputOption;
1314
use Symfony\Component\Console\Output\OutputInterface;
1415

16+
#[AsCommand('enqueue:produce')]
1517
class ProduceCommand extends Command
1618
{
1719
protected static $defaultName = 'enqueue:produce';

pkg/enqueue/Symfony/Client/RoutesCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
use Enqueue\Client\Route;
77
use Psr\Container\ContainerInterface;
88
use Psr\Container\NotFoundExceptionInterface;
9+
use Symfony\Component\Console\Attribute\AsCommand;
910
use Symfony\Component\Console\Command\Command;
1011
use Symfony\Component\Console\Helper\Table;
1112
use Symfony\Component\Console\Helper\TableSeparator;
1213
use Symfony\Component\Console\Input\InputInterface;
1314
use Symfony\Component\Console\Input\InputOption;
1415
use Symfony\Component\Console\Output\OutputInterface;
1516

17+
#[AsCommand('enqueue:routes')]
1618
class RoutesCommand extends Command
1719
{
1820
protected static $defaultName = 'enqueue:routes';

pkg/enqueue/Symfony/Client/SetupBrokerCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
use Enqueue\Client\DriverInterface;
66
use Psr\Container\ContainerInterface;
77
use Psr\Container\NotFoundExceptionInterface;
8+
use Symfony\Component\Console\Attribute\AsCommand;
89
use Symfony\Component\Console\Command\Command;
910
use Symfony\Component\Console\Input\InputInterface;
1011
use Symfony\Component\Console\Input\InputOption;
1112
use Symfony\Component\Console\Logger\ConsoleLogger;
1213
use Symfony\Component\Console\Output\OutputInterface;
1314

15+
#[AsCommand('enqueue:setup-broker')]
1416
class SetupBrokerCommand extends Command
1517
{
1618
protected static $defaultName = 'enqueue:setup-broker';

pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@
88
use Enqueue\ProcessorRegistryInterface;
99
use Psr\Container\ContainerInterface;
1010
use Psr\Container\NotFoundExceptionInterface;
11+
use Symfony\Component\Console\Attribute\AsCommand;
1112
use Symfony\Component\Console\Command\Command;
1213
use Symfony\Component\Console\Input\InputArgument;
1314
use Symfony\Component\Console\Input\InputInterface;
1415
use Symfony\Component\Console\Input\InputOption;
1516
use Symfony\Component\Console\Output\OutputInterface;
1617

18+
#[AsCommand('enqueue:transport:consume')]
1719
class ConfigurableConsumeCommand extends Command
1820
{
21+
use ChooseLoggerCommandTrait;
1922
use LimitsExtensionsCommandTrait;
2023
use QueueConsumerOptionsCommandTrait;
21-
use ChooseLoggerCommandTrait;
2224

2325
protected static $defaultName = 'enqueue:transport:consume';
2426

pkg/enqueue/Symfony/Consumption/ConsumeCommand.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
use Enqueue\Consumption\QueueConsumerInterface;
88
use Psr\Container\ContainerInterface;
99
use Psr\Container\NotFoundExceptionInterface;
10+
use Symfony\Component\Console\Attribute\AsCommand;
1011
use Symfony\Component\Console\Command\Command;
1112
use Symfony\Component\Console\Input\InputInterface;
1213
use Symfony\Component\Console\Input\InputOption;
1314
use Symfony\Component\Console\Output\OutputInterface;
1415

16+
#[AsCommand('enqueue:transport:consume')]
1517
class ConsumeCommand extends Command
1618
{
19+
use ChooseLoggerCommandTrait;
1720
use LimitsExtensionsCommandTrait;
1821
use QueueConsumerOptionsCommandTrait;
19-
use ChooseLoggerCommandTrait;
2022

2123
protected static $defaultName = 'enqueue:transport:consume';
2224

0 commit comments

Comments
 (0)