Skip to content

Commit

Permalink
Use #[AsCommand] attribute on commands
Browse files Browse the repository at this point in the history
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
  },
```
  • Loading branch information
ruudk committed Oct 15, 2023
1 parent ad06c60 commit 4b3c6e9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Symfony/Client/ConsumeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,20 @@
use Interop\Queue\Processor;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand('enqueue:consume')]
class ConsumeCommand extends Command
{
use ChooseLoggerCommandTrait;
use LimitsExtensionsCommandTrait;
use SetupBrokerExtensionCommandTrait;
use QueueConsumerOptionsCommandTrait;
use ChooseLoggerCommandTrait;
use SetupBrokerExtensionCommandTrait;

protected static $defaultName = 'enqueue:consume';

Expand Down
2 changes: 2 additions & 0 deletions Symfony/Client/ProduceCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
use Enqueue\Client\ProducerInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand('enqueue:produce')]
class ProduceCommand extends Command
{
protected static $defaultName = 'enqueue:produce';
Expand Down
2 changes: 2 additions & 0 deletions Symfony/Client/RoutesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
use Enqueue\Client\Route;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableSeparator;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand('enqueue:routes')]
class RoutesCommand extends Command
{
protected static $defaultName = 'enqueue:routes';
Expand Down
2 changes: 2 additions & 0 deletions Symfony/Client/SetupBrokerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
use Enqueue\Client\DriverInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Logger\ConsoleLogger;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand('enqueue:setup-broker')]
class SetupBrokerCommand extends Command
{
protected static $defaultName = 'enqueue:setup-broker';
Expand Down
4 changes: 3 additions & 1 deletion Symfony/Consumption/ConfigurableConsumeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@
use Enqueue\ProcessorRegistryInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand('enqueue:transport:consume')]
class ConfigurableConsumeCommand extends Command
{
use ChooseLoggerCommandTrait;
use LimitsExtensionsCommandTrait;
use QueueConsumerOptionsCommandTrait;
use ChooseLoggerCommandTrait;

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

Expand Down
4 changes: 3 additions & 1 deletion Symfony/Consumption/ConsumeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
use Enqueue\Consumption\QueueConsumerInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand('enqueue:transport:consume')]
class ConsumeCommand extends Command
{
use ChooseLoggerCommandTrait;
use LimitsExtensionsCommandTrait;
use QueueConsumerOptionsCommandTrait;
use ChooseLoggerCommandTrait;

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

Expand Down

0 comments on commit 4b3c6e9

Please sign in to comment.