Skip to content

Use #[AsCommand] attribute on commands #1311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.2'
coverage: none
extensions: mongodb, redis, :xdebug
ini-values: memory_limit=2048M
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG PHP_VERSION=7.4
ARG PHP_VERSION=8.2
FROM makasim/nginx-php-fpm:${PHP_VERSION}-all-exts

ARG PHP_VERSION
6 changes: 4 additions & 2 deletions pkg/enqueue/Symfony/Client/ConsumeCommand.php
Original file line number Diff line number Diff line change
@@ -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';

2 changes: 2 additions & 0 deletions pkg/enqueue/Symfony/Client/ProduceCommand.php
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 2 additions & 0 deletions pkg/enqueue/Symfony/Client/RoutesCommand.php
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 2 additions & 0 deletions pkg/enqueue/Symfony/Client/SetupBrokerCommand.php
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
@@ -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';

4 changes: 3 additions & 1 deletion pkg/enqueue/Symfony/Consumption/ConsumeCommand.php
Original file line number Diff line number Diff line change
@@ -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';

4 changes: 2 additions & 2 deletions pkg/sns/Tests/SnsClientTest.php
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ public function testShouldAllowGetAwsClientIfSingleClientProvided()
$awsClient = (new Sdk(['Sns' => [
'key' => '',
'secret' => '',
'region' => '',
'region' => 'us-west-2',
'version' => '2010-03-31',
'endpoint' => 'http://localhost',
]]))->createSns();
@@ -31,7 +31,7 @@ public function testShouldAllowGetAwsClientIfMultipleClientProvided()
$awsClient = (new Sdk(['Sns' => [
'key' => '',
'secret' => '',
'region' => '',
'region' => 'us-west-2',
'version' => '2010-03-31',
'endpoint' => 'http://localhost',
]]))->createMultiRegionSns();
4 changes: 2 additions & 2 deletions pkg/sqs/Tests/SqsClientTest.php
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ public function testShouldAllowGetAwsClientIfSingleClientProvided()
$awsClient = (new Sdk(['Sqs' => [
'key' => '',
'secret' => '',
'region' => '',
'region' => 'us-west-2',
'version' => '2012-11-05',
'endpoint' => 'http://localhost',
]]))->createSqs();
@@ -31,7 +31,7 @@ public function testShouldAllowGetAwsClientIfMultipleClientProvided()
$awsClient = (new Sdk(['Sqs' => [
'key' => '',
'secret' => '',
'region' => '',
'region' => 'us-west-2',
'version' => '2012-11-05',
'endpoint' => 'http://localhost',
]]))->createMultiRegionSqs();