From c27ad782228ae9f92a958b8557c35f1e75e877fc Mon Sep 17 00:00:00 2001 From: Viktor Zavitkov Date: Mon, 18 Nov 2024 11:15:26 +0300 Subject: [PATCH 1/2] fix deprecations --- composer.json | 6 +++--- phpstan.neon | 2 +- .../DependencyInjection/EnqueueExtension.php | 2 +- .../Profiler/AbstractMessageQueueCollector.php | 10 +--------- pkg/enqueue-bundle/Profiler/MessageQueueCollector.php | 3 +-- 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index 5308d33dd..e1f64ca02 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "require-dev": { "ext-pcntl": "*", "phpunit/phpunit": "^9.5", - "phpstan/phpstan": "^0.12", + "phpstan/phpstan": "^1.0", "queue-interop/queue-spec": "^0.6.2", "symfony/browser-kit": "^6.2|^7.0", "symfony/config": "^6.2|^7.0", @@ -60,9 +60,9 @@ "symfony/dependency-injection": "^6.2|^7.0", "symfony/event-dispatcher": "^6.2|^7.0", "symfony/expression-language": "^6.2|^7.0", - "symfony/http-kernel": "^^6.2|^7.0", + "symfony/http-kernel": "^6.2|^7.0", "symfony/filesystem": "^6.2|^7.0", - "symfony/framework-bundle": "^^6.2|^7.0", + "symfony/framework-bundle": "^6.2|^7.0", "symfony/validator": "^6.2|^7.0", "symfony/yaml": "^6.2|^7.0", "empi89/php-amqp-stubs": "*@dev", diff --git a/phpstan.neon b/phpstan.neon index 3bd6187d9..88be8a7e1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ parameters: - excludes_analyse: + excludePaths: - docs - bin - docker diff --git a/pkg/enqueue-bundle/DependencyInjection/EnqueueExtension.php b/pkg/enqueue-bundle/DependencyInjection/EnqueueExtension.php index c5dbbbc96..96fca6fde 100644 --- a/pkg/enqueue-bundle/DependencyInjection/EnqueueExtension.php +++ b/pkg/enqueue-bundle/DependencyInjection/EnqueueExtension.php @@ -22,10 +22,10 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; final class EnqueueExtension extends Extension implements PrependExtensionInterface { diff --git a/pkg/enqueue-bundle/Profiler/AbstractMessageQueueCollector.php b/pkg/enqueue-bundle/Profiler/AbstractMessageQueueCollector.php index 323d146d1..e2e5eee5a 100644 --- a/pkg/enqueue-bundle/Profiler/AbstractMessageQueueCollector.php +++ b/pkg/enqueue-bundle/Profiler/AbstractMessageQueueCollector.php @@ -59,8 +59,6 @@ public function prettyPrintPriority($priority) } /** - * @param mixed $body - * * @return string */ public function ensureString($body) @@ -68,18 +66,12 @@ public function ensureString($body) return is_string($body) ? $body : JSON::encode($body); } - /** - * {@inheritdoc} - */ public function getName(): string { return 'enqueue.message_queue'; } - /** - * {@inheritdoc} - */ - public function reset() + public function reset(): void { $this->data = []; } diff --git a/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php b/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php index 7fc6699c5..3c484a7d1 100644 --- a/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php +++ b/pkg/enqueue-bundle/Profiler/MessageQueueCollector.php @@ -4,11 +4,10 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Throwable; class MessageQueueCollector extends AbstractMessageQueueCollector { - public function collect(Request $request, Response $response, Throwable $exception = null) + public function collect(Request $request, Response $response, ?\Throwable $exception = null): void { $this->collectInternal($request, $response); } From 60ff029966772326902d851689653511e547be0d Mon Sep 17 00:00:00 2001 From: Viktor Zavitkov Date: Mon, 18 Nov 2024 11:28:10 +0300 Subject: [PATCH 2/2] fix test --- .../Tests/Unit/DependencyInjection/EnqueueExtensionTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/EnqueueExtensionTest.php b/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/EnqueueExtensionTest.php index 51bbaa26d..3b8d0426d 100644 --- a/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/EnqueueExtensionTest.php +++ b/pkg/enqueue-bundle/Tests/Unit/DependencyInjection/EnqueueExtensionTest.php @@ -13,8 +13,8 @@ use Enqueue\Test\ClassExtensionTrait; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\HttpKernel\DependencyInjection\Extension; class EnqueueExtensionTest extends TestCase { @@ -22,12 +22,12 @@ class EnqueueExtensionTest extends TestCase public function testShouldImplementConfigurationInterface() { - self::assertClassExtends(Extension::class, EnqueueExtension::class); + $this->assertClassExtends(Extension::class, EnqueueExtension::class); } public function testShouldBeFinal() { - self::assertClassFinal(EnqueueExtension::class); + $this->assertClassFinal(EnqueueExtension::class); } public function testCouldBeConstructedWithoutAnyArguments()