From bbe1e6e65fa5a8242dcac19e8de39e5669b2c11a Mon Sep 17 00:00:00 2001 From: Ruud Kamphuis Date: Wed, 16 Aug 2023 18:31:45 +0200 Subject: [PATCH 1/4] 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 }, ``` --- pkg/enqueue/Symfony/Client/ConsumeCommand.php | 6 ++++-- pkg/enqueue/Symfony/Client/ProduceCommand.php | 2 ++ pkg/enqueue/Symfony/Client/RoutesCommand.php | 2 ++ pkg/enqueue/Symfony/Client/SetupBrokerCommand.php | 2 ++ .../Symfony/Consumption/ConfigurableConsumeCommand.php | 4 +++- pkg/enqueue/Symfony/Consumption/ConsumeCommand.php | 4 +++- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pkg/enqueue/Symfony/Client/ConsumeCommand.php b/pkg/enqueue/Symfony/Client/ConsumeCommand.php index 4b65f6276..39af6d592 100644 --- a/pkg/enqueue/Symfony/Client/ConsumeCommand.php +++ b/pkg/enqueue/Symfony/Client/ConsumeCommand.php @@ -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'; diff --git a/pkg/enqueue/Symfony/Client/ProduceCommand.php b/pkg/enqueue/Symfony/Client/ProduceCommand.php index 667871c71..6064f82e1 100644 --- a/pkg/enqueue/Symfony/Client/ProduceCommand.php +++ b/pkg/enqueue/Symfony/Client/ProduceCommand.php @@ -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'; diff --git a/pkg/enqueue/Symfony/Client/RoutesCommand.php b/pkg/enqueue/Symfony/Client/RoutesCommand.php index 5419f3beb..59a4a4d98 100644 --- a/pkg/enqueue/Symfony/Client/RoutesCommand.php +++ b/pkg/enqueue/Symfony/Client/RoutesCommand.php @@ -6,6 +6,7 @@ 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; @@ -13,6 +14,7 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +#[AsCommand('enqueue:routes')] class RoutesCommand extends Command { protected static $defaultName = 'enqueue:routes'; diff --git a/pkg/enqueue/Symfony/Client/SetupBrokerCommand.php b/pkg/enqueue/Symfony/Client/SetupBrokerCommand.php index 65d52ee31..68aebb582 100644 --- a/pkg/enqueue/Symfony/Client/SetupBrokerCommand.php +++ b/pkg/enqueue/Symfony/Client/SetupBrokerCommand.php @@ -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'; diff --git a/pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php b/pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php index 9ec8a36f3..234eb0497 100644 --- a/pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php +++ b/pkg/enqueue/Symfony/Consumption/ConfigurableConsumeCommand.php @@ -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'; diff --git a/pkg/enqueue/Symfony/Consumption/ConsumeCommand.php b/pkg/enqueue/Symfony/Consumption/ConsumeCommand.php index b1a54c163..870cc5f60 100644 --- a/pkg/enqueue/Symfony/Consumption/ConsumeCommand.php +++ b/pkg/enqueue/Symfony/Consumption/ConsumeCommand.php @@ -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'; From 70d811746947e7d34a568977875a84c8f3ba5715 Mon Sep 17 00:00:00 2001 From: Ruud Kamphuis Date: Wed, 16 Aug 2023 18:30:40 +0200 Subject: [PATCH 2/4] Run PHPStan on 8.0 This way it understands attributes. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 616470279..c29d8430c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 From 3954dedf0b1544bd0632f83110df0e2a181a7a7d Mon Sep 17 00:00:00 2001 From: Ruud Kamphuis Date: Thu, 17 Aug 2023 13:04:45 +0200 Subject: [PATCH 3/4] Change PHP version in Docker to 8.2 --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 4c288b041..b2f30c62e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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 From 774ccdf605699fa7e65ce9d674526eac139d19d6 Mon Sep 17 00:00:00 2001 From: Ruud Kamphuis Date: Sun, 15 Oct 2023 11:30:54 +0200 Subject: [PATCH 4/4] Fix CI Credits to VincentLanglet --- pkg/sns/Tests/SnsClientTest.php | 4 ++-- pkg/sqs/Tests/SqsClientTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/sns/Tests/SnsClientTest.php b/pkg/sns/Tests/SnsClientTest.php index e4fb15402..a029f4fd0 100644 --- a/pkg/sns/Tests/SnsClientTest.php +++ b/pkg/sns/Tests/SnsClientTest.php @@ -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(); diff --git a/pkg/sqs/Tests/SqsClientTest.php b/pkg/sqs/Tests/SqsClientTest.php index d7c583fd1..ff6a966d4 100644 --- a/pkg/sqs/Tests/SqsClientTest.php +++ b/pkg/sqs/Tests/SqsClientTest.php @@ -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();