From 9db9782908f1f236aa0a202b8fc7c0e6da2ab2c8 Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Wed, 15 Nov 2017 15:36:43 +0200
Subject: [PATCH 01/61] add homepage link to composer.json

---
 composer.json | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index 35e39f3..a5fc506 100644
--- a/composer.json
+++ b/composer.json
@@ -1,8 +1,9 @@
 {
     "name": "enqueue/async-event-dispatcher",
     "type": "library",
-    "description": "Symfony async event dispathcer",
+    "description": "Symfony async event dispatcher",
     "keywords": ["messaging", "queue", "async event", "event dispatcher"],
+    "homepage": "https://github.com/php-enqueue/enqueue-dev",
     "license": "MIT",
     "require": {
         "php": ">=5.6",

From 1cfb5f842c0813be3e359bb89bc1eedf9c011cc1 Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Wed, 15 Nov 2017 12:18:06 +0200
Subject: [PATCH 02/61] Add Symfony4 support.

---
 .../AsyncEventDispatcherExtension.php                |  3 ++-
 Resources/config/services.yml                        |  4 ++++
 composer.json                                        | 12 ++++++------
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/DependencyInjection/AsyncEventDispatcherExtension.php b/DependencyInjection/AsyncEventDispatcherExtension.php
index 160999d..d417bce 100644
--- a/DependencyInjection/AsyncEventDispatcherExtension.php
+++ b/DependencyInjection/AsyncEventDispatcherExtension.php
@@ -4,6 +4,7 @@
 
 use Enqueue\AsyncEventDispatcher\OldAsyncEventDispatcher;
 use Symfony\Component\Config\FileLocator;
+use Symfony\Component\DependencyInjection\Alias;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\DependencyInjection\Definition;
 use Symfony\Component\DependencyInjection\Extension\Extension;
@@ -20,7 +21,7 @@ public function load(array $configs, ContainerBuilder $container)
     {
         $config = $this->processConfiguration(new Configuration(), $configs);
 
-        $container->setAlias('enqueue.events.context', $config['context_service']);
+        $container->setAlias('enqueue.events.context', new Alias($config['context_service'], true));
 
         $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
         $loader->load('services.yml');
diff --git a/Resources/config/services.yml b/Resources/config/services.yml
index 94dd698..e291605 100644
--- a/Resources/config/services.yml
+++ b/Resources/config/services.yml
@@ -14,17 +14,20 @@ services:
 
     enqueue.events.async_listener:
         class: 'Enqueue\AsyncEventDispatcher\AsyncListener'
+        public: public
         arguments: ['@enqueue.events.context', '@enqueue.events.registry', '%enqueue_events_queue%']
 
 
     enqueue.events.event_dispatcher:
         class: 'Enqueue\AsyncEventDispatcher\AsyncEventDispatcher'
+        public: public
         arguments:
             - '@event_dispatcher'
             - '@enqueue.events.async_listener'
 
     enqueue.events.async_processor:
         class: 'Enqueue\AsyncEventDispatcher\AsyncProcessor'
+        public: public
         arguments:
             - '@enqueue.events.registry'
             - '@enqueue.events.event_dispatcher'
@@ -39,6 +42,7 @@ services:
 
     enqueue.events.php_serializer_event_transofrmer:
         class: 'Enqueue\AsyncEventDispatcher\PhpSerializerEventTransformer'
+        public: public
         arguments:
             - '@enqueue.events.context'
         tags:
diff --git a/composer.json b/composer.json
index a5fc506..0e416d8 100644
--- a/composer.json
+++ b/composer.json
@@ -8,20 +8,20 @@
     "require": {
         "php": ">=5.6",
         "enqueue/enqueue": "^0.8@dev",
-        "symfony/event-dispatcher": "^2.8|^3"
+        "symfony/event-dispatcher": "^2.8|^3|^4"
     },
     "require-dev": {
         "phpunit/phpunit": "~5.5",
-        "symfony/dependency-injection": "^2.8|^3",
-        "symfony/config": "^2.8|^3",
-        "symfony/http-kernel": "^2.8|^3",
-        "symfony/filesystem": "^2.8|^3",
+        "symfony/dependency-injection": "^2.8|^3|^4",
+        "symfony/config": "^2.8|^3|^4",
+        "symfony/http-kernel": "^2.8|^3|^4",
+        "symfony/filesystem": "^2.8|^3|^4",
         "enqueue/null": "^0.8@dev",
         "enqueue/fs": "^0.8@dev",
         "enqueue/test": "^0.8@dev"
     },
     "suggest": {
-        "symfony/dependency-injection": "^2.8|^3 If you'd like to use async event dispatcher container extension."
+        "symfony/dependency-injection": "^2.8|^3|^4 If you'd like to use async event dispatcher container extension."
     },
     "autoload": {
         "psr-4": { "Enqueue\\AsyncEventDispatcher\\": "" },

From ee53ac9b898c7d3cf4d5ac84023b93ef3ebd5e08 Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Thu, 14 Dec 2017 14:20:06 +0200
Subject: [PATCH 03/61] [composer] add support section.

fixes https://github.com/php-enqueue/enqueue-dev/issues/288
---
 composer.json | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/composer.json b/composer.json
index 0e416d8..28a9d4b 100644
--- a/composer.json
+++ b/composer.json
@@ -20,6 +20,13 @@
         "enqueue/fs": "^0.8@dev",
         "enqueue/test": "^0.8@dev"
     },
+    "support": {
+        "email": "opensource@forma-pro.com",
+        "issues": "https://github.com/php-enqueue/enqueue-dev/issues",
+        "forum": "https://gitter.im/php-enqueue/Lobby",
+        "source": "https://github.com/php-enqueue/enqueue-dev",
+        "docs": "https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md"
+    },
     "suggest": {
         "symfony/dependency-injection": "^2.8|^3|^4 If you'd like to use async event dispatcher container extension."
     },

From 3059b016a8eb440170f537fbd9cf738f994a5cbf Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Thu, 4 Jan 2018 11:46:31 +0200
Subject: [PATCH 04/61] Add link to site.

---
 README.md     | 1 +
 composer.json | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 3df85a5..4e8f2ce 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,7 @@ It allows to processes events in background by sending them to MQ.
 
 ## Resources
 
+* [Site](https://enqueue.forma-pro.com/)
 * [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
 * [Questions](https://gitter.im/php-enqueue/Lobby)
 * [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)
diff --git a/composer.json b/composer.json
index 28a9d4b..007e869 100644
--- a/composer.json
+++ b/composer.json
@@ -3,7 +3,7 @@
     "type": "library",
     "description": "Symfony async event dispatcher",
     "keywords": ["messaging", "queue", "async event", "event dispatcher"],
-    "homepage": "https://github.com/php-enqueue/enqueue-dev",
+    "homepage": "https://enqueue.forma-pro.com/",
     "license": "MIT",
     "require": {
         "php": ">=5.6",

From b032d0dc2554d1f006c31884f7c46f22f2b7c77e Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Wed, 17 Jan 2018 09:57:24 +0200
Subject: [PATCH 05/61] 0.9

---
 composer.json | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/composer.json b/composer.json
index 007e869..2d1294f 100644
--- a/composer.json
+++ b/composer.json
@@ -7,7 +7,7 @@
     "license": "MIT",
     "require": {
         "php": ">=5.6",
-        "enqueue/enqueue": "^0.8@dev",
+        "enqueue/enqueue": "^0.9@dev",
         "symfony/event-dispatcher": "^2.8|^3|^4"
     },
     "require-dev": {
@@ -16,9 +16,9 @@
         "symfony/config": "^2.8|^3|^4",
         "symfony/http-kernel": "^2.8|^3|^4",
         "symfony/filesystem": "^2.8|^3|^4",
-        "enqueue/null": "^0.8@dev",
-        "enqueue/fs": "^0.8@dev",
-        "enqueue/test": "^0.8@dev"
+        "enqueue/null": "^0.9@dev",
+        "enqueue/fs": "^0.9@dev",
+        "enqueue/test": "^0.9@dev"
     },
     "support": {
         "email": "opensource@forma-pro.com",
@@ -38,7 +38,7 @@
     },
     "extra": {
         "branch-alias": {
-            "dev-master": "0.8.x-dev"
+            "dev-master": "0.9.x-dev"
         }
     }
 }

From 36902adf96e01a4db2311fd7896b9e5c96ed29de Mon Sep 17 00:00:00 2001
From: Pascal Borreli <pascal@borreli.com>
Date: Fri, 23 Mar 2018 11:52:55 +0100
Subject: [PATCH 06/61] Fixed typos

---
 Tests/ProxyEventDispatcherTest.php | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Tests/ProxyEventDispatcherTest.php b/Tests/ProxyEventDispatcherTest.php
index 5e5c6e9..7c83191 100644
--- a/Tests/ProxyEventDispatcherTest.php
+++ b/Tests/ProxyEventDispatcherTest.php
@@ -20,7 +20,7 @@ public function testShouldBeSubClassOfEventDispatcher()
 
     public function testShouldSetSyncModeForGivenEventNameOnDispatchAsyncListenersOnly()
     {
-        $asyncListenerMock = $this->createAsyncLisenerMock();
+        $asyncListenerMock = $this->createAsyncListenerMock();
         $asyncListenerMock
             ->expects($this->once())
             ->method('resetSyncMode')
@@ -49,7 +49,7 @@ public function testShouldCallAsyncEventButNotOtherOnDispatchAsyncListenersOnly(
         });
 
         $asyncEventWasCalled = false;
-        $dispatcher = new AsyncEventDispatcher($trueEventDispatcher, $this->createAsyncLisenerMock());
+        $dispatcher = new AsyncEventDispatcher($trueEventDispatcher, $this->createAsyncListenerMock());
         $dispatcher->addListener('theEvent', function () use (&$asyncEventWasCalled) {
             $this->assertInstanceOf(AsyncEventDispatcher::class, func_get_arg(2));
 
@@ -74,7 +74,7 @@ public function testShouldCallOtherEventIfDispatchedFromAsyncEventOnDispatchAsyn
         });
 
         $asyncEventWasCalled = false;
-        $dispatcher = new AsyncEventDispatcher($trueEventDispatcher, $this->createAsyncLisenerMock());
+        $dispatcher = new AsyncEventDispatcher($trueEventDispatcher, $this->createAsyncListenerMock());
         $dispatcher->addListener('theEvent', function () use (&$asyncEventWasCalled) {
             $this->assertInstanceOf(AsyncEventDispatcher::class, func_get_arg(2));
 
@@ -97,7 +97,7 @@ public function testShouldNotCallAsyncEventIfDispatchedFromOtherEventOnDispatchA
             func_get_arg(2)->dispatch('theOtherAsyncEvent');
         });
 
-        $dispatcher = new AsyncEventDispatcher($trueEventDispatcher, $this->createAsyncLisenerMock());
+        $dispatcher = new AsyncEventDispatcher($trueEventDispatcher, $this->createAsyncListenerMock());
         $dispatcher->addListener('theAsyncEvent', function () {
             func_get_arg(2)->dispatch('theOtherEvent');
         });
@@ -115,7 +115,7 @@ public function testShouldNotCallAsyncEventIfDispatchedFromOtherEventOnDispatchA
     /**
      * @return \PHPUnit_Framework_MockObject_MockObject|AsyncListener
      */
-    private function createAsyncLisenerMock()
+    private function createAsyncListenerMock()
     {
         return $this->createMock(AsyncListener::class);
     }

From 419e3e8c98a8c878b625b42fde17cbeba26fc4ff Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Thu, 5 Apr 2018 10:25:20 +0300
Subject: [PATCH 07/61] Drop PHP5 support, Require Queue Interop with PHP7
 features.

---
 composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index 2d1294f..b91fb81 100644
--- a/composer.json
+++ b/composer.json
@@ -6,7 +6,7 @@
     "homepage": "https://enqueue.forma-pro.com/",
     "license": "MIT",
     "require": {
-        "php": ">=5.6",
+        "php": "^7.1.3",
         "enqueue/enqueue": "^0.9@dev",
         "symfony/event-dispatcher": "^2.8|^3|^4"
     },

From 4cd8c844e1800c6995dcca978aae137dd38d67f0 Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Thu, 5 Apr 2018 10:30:01 +0300
Subject: [PATCH 08/61] Drop Symfony 2.x support, set Symfony 3.4 minimum
 supported version.

---
 composer.json | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/composer.json b/composer.json
index b91fb81..b71e7e3 100644
--- a/composer.json
+++ b/composer.json
@@ -8,14 +8,14 @@
     "require": {
         "php": "^7.1.3",
         "enqueue/enqueue": "^0.9@dev",
-        "symfony/event-dispatcher": "^2.8|^3|^4"
+        "symfony/event-dispatcher": "^3.4|^4"
     },
     "require-dev": {
         "phpunit/phpunit": "~5.5",
-        "symfony/dependency-injection": "^2.8|^3|^4",
-        "symfony/config": "^2.8|^3|^4",
-        "symfony/http-kernel": "^2.8|^3|^4",
-        "symfony/filesystem": "^2.8|^3|^4",
+        "symfony/dependency-injection": "^3.4|^4",
+        "symfony/config": "^3.4|^4",
+        "symfony/http-kernel": "^3.4|^4",
+        "symfony/filesystem": "^3.4|^4",
         "enqueue/null": "^0.9@dev",
         "enqueue/fs": "^0.9@dev",
         "enqueue/test": "^0.9@dev"

From f3a7c056ebb5a021656f4bdb8e645a7d1d726f8e Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Wed, 8 Aug 2018 17:32:42 +0300
Subject: [PATCH 09/61] fix req.

---
 composer.json | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/composer.json b/composer.json
index b71e7e3..03055cf 100644
--- a/composer.json
+++ b/composer.json
@@ -7,7 +7,7 @@
     "license": "MIT",
     "require": {
         "php": "^7.1.3",
-        "enqueue/enqueue": "^0.9@dev",
+        "enqueue/enqueue": "0.9.x-dev",
         "symfony/event-dispatcher": "^3.4|^4"
     },
     "require-dev": {
@@ -16,9 +16,9 @@
         "symfony/config": "^3.4|^4",
         "symfony/http-kernel": "^3.4|^4",
         "symfony/filesystem": "^3.4|^4",
-        "enqueue/null": "^0.9@dev",
-        "enqueue/fs": "^0.9@dev",
-        "enqueue/test": "^0.9@dev"
+        "enqueue/null": "0.9.x-dev",
+        "enqueue/fs": "0.9.x-dev",
+        "enqueue/test": "0.9.x-dev"
     },
     "support": {
         "email": "opensource@forma-pro.com",

From c255c58a3ace042b0e80ddb2c05a2f5e6db2c9ff Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Mon, 13 Aug 2018 16:15:21 +0300
Subject: [PATCH 10/61] Remove support of old Symfony versions.

---
 AsyncProcessor.php                            |  7 +--
 .../AsyncEventDispatcherExtension.php         | 12 ----
 OldAsyncEventDispatcher.php                   | 61 -------------------
 PhpSerializerEventTransformer.php             | 30 +--------
 Tests/PhpSerializerEventTransformerTest.php   | 37 -----------
 5 files changed, 4 insertions(+), 143 deletions(-)
 delete mode 100644 OldAsyncEventDispatcher.php

diff --git a/AsyncProcessor.php b/AsyncProcessor.php
index a472d76..a82a282 100644
--- a/AsyncProcessor.php
+++ b/AsyncProcessor.php
@@ -16,7 +16,7 @@ class AsyncProcessor implements PsrProcessor
     private $registry;
 
     /**
-     * @var AsyncEventDispatcher|OldAsyncEventDispatcher
+     * @var AsyncEventDispatcher
      */
     private $dispatcher;
 
@@ -28,11 +28,10 @@ public function __construct(Registry $registry, EventDispatcherInterface $dispat
     {
         $this->registry = $registry;
 
-        if (false == ($dispatcher instanceof AsyncEventDispatcher || $dispatcher instanceof OldAsyncEventDispatcher)) {
+        if (false == $dispatcher instanceof AsyncEventDispatcher) {
             throw new \InvalidArgumentException(sprintf(
-                'The dispatcher argument must be either instance of "%s" or "%s" but got "%s"',
+                'The dispatcher argument must be instance of "%s" but got "%s"',
                 AsyncEventDispatcher::class,
-                OldAsyncEventDispatcher::class,
                 get_class($dispatcher)
             ));
         }
diff --git a/DependencyInjection/AsyncEventDispatcherExtension.php b/DependencyInjection/AsyncEventDispatcherExtension.php
index d417bce..b2ec12f 100644
--- a/DependencyInjection/AsyncEventDispatcherExtension.php
+++ b/DependencyInjection/AsyncEventDispatcherExtension.php
@@ -2,15 +2,11 @@
 
 namespace Enqueue\AsyncEventDispatcher\DependencyInjection;
 
-use Enqueue\AsyncEventDispatcher\OldAsyncEventDispatcher;
 use Symfony\Component\Config\FileLocator;
 use Symfony\Component\DependencyInjection\Alias;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Definition;
 use Symfony\Component\DependencyInjection\Extension\Extension;
 use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
-use Symfony\Component\DependencyInjection\Reference;
-use Symfony\Component\HttpKernel\Kernel;
 
 class AsyncEventDispatcherExtension extends Extension
 {
@@ -25,13 +21,5 @@ public function load(array $configs, ContainerBuilder $container)
 
         $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
         $loader->load('services.yml');
-
-        if (version_compare(Kernel::VERSION, '3.3', '<')) {
-            $container->setDefinition('enqueue.events.event_dispatcher', new Definition(OldAsyncEventDispatcher::class, [
-                new Reference('service_container'),
-                new Reference('event_dispatcher'),
-                new Reference('enqueue.events.async_listener'),
-            ]));
-        }
     }
 }
diff --git a/OldAsyncEventDispatcher.php b/OldAsyncEventDispatcher.php
deleted file mode 100644
index 97720af..0000000
--- a/OldAsyncEventDispatcher.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-namespace Enqueue\AsyncEventDispatcher;
-
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
-use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-
-class OldAsyncEventDispatcher extends ContainerAwareEventDispatcher
-{
-    /**
-     * @var EventDispatcherInterface
-     */
-    private $trueEventDispatcher;
-
-    /**
-     * @var AsyncListener
-     */
-    private $asyncListener;
-
-    /**
-     * @param ContainerInterface       $container
-     * @param EventDispatcherInterface $trueEventDispatcher
-     * @param AsyncListener            $asyncListener
-     */
-    public function __construct(ContainerInterface $container, EventDispatcherInterface $trueEventDispatcher, AsyncListener $asyncListener)
-    {
-        parent::__construct($container);
-
-        $this->trueEventDispatcher = $trueEventDispatcher;
-        $this->asyncListener = $asyncListener;
-    }
-
-    /**
-     * This method dispatches only those listeners that were marked as async.
-     *
-     * @param string     $eventName
-     * @param Event|null $event
-     */
-    public function dispatchAsyncListenersOnly($eventName, Event $event = null)
-    {
-        try {
-            $this->asyncListener->syncMode($eventName);
-
-            parent::dispatch($eventName, $event);
-        } finally {
-            $this->asyncListener->resetSyncMode();
-        }
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function dispatch($eventName, Event $event = null)
-    {
-        parent::dispatch($eventName, $event);
-
-        $this->trueEventDispatcher->dispatch($eventName, $event);
-    }
-}
diff --git a/PhpSerializerEventTransformer.php b/PhpSerializerEventTransformer.php
index d99d0d4..0b9e347 100644
--- a/PhpSerializerEventTransformer.php
+++ b/PhpSerializerEventTransformer.php
@@ -5,7 +5,6 @@
 use Interop\Queue\PsrContext;
 use Interop\Queue\PsrMessage;
 use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\HttpKernel\Kernel;
 
 class PhpSerializerEventTransformer implements EventTransformer
 {
@@ -14,19 +13,12 @@ class PhpSerializerEventTransformer implements EventTransformer
      */
     private $context;
 
-    /**
-     * @var bool
-     */
-    private $skipSymfonyVersionCheck;
-
     /**
      * @param PsrContext $context
-     * @param bool       $skipSymfonyVersionCheck It is useful when async dispatcher is used without Kernel. So there is no way to check the version.
      */
-    public function __construct(PsrContext $context, $skipSymfonyVersionCheck = false)
+    public function __construct(PsrContext $context)
     {
         $this->context = $context;
-        $this->skipSymfonyVersionCheck = $skipSymfonyVersionCheck;
     }
 
     /**
@@ -34,8 +26,6 @@ public function __construct(PsrContext $context, $skipSymfonyVersionCheck = fals
      */
     public function toMessage($eventName, Event $event = null)
     {
-        $this->assertSymfony30OrHigher();
-
         return $this->context->createMessage(serialize($event));
     }
 
@@ -44,24 +34,6 @@ public function toMessage($eventName, Event $event = null)
      */
     public function toEvent($eventName, PsrMessage $message)
     {
-        $this->assertSymfony30OrHigher();
-
         return unserialize($message->getBody());
     }
-
-    private function assertSymfony30OrHigher()
-    {
-        if ($this->skipSymfonyVersionCheck) {
-            return;
-        }
-
-        if (version_compare(Kernel::VERSION, '3.0', '<')) {
-            throw new \LogicException(
-                'This transformer does not work on Symfony prior 3.0. '.
-                'The event contains eventDispatcher and therefor could not be serialized. '.
-                'You have to register a transformer for every async event. '.
-                'Read the doc: https://github.com/php-enqueue/enqueue-dev/blob/master/docs/bundle/async_events.md#event-transformer'
-            );
-        }
-    }
 }
diff --git a/Tests/PhpSerializerEventTransformerTest.php b/Tests/PhpSerializerEventTransformerTest.php
index 407b44c..ee89d92 100644
--- a/Tests/PhpSerializerEventTransformerTest.php
+++ b/Tests/PhpSerializerEventTransformerTest.php
@@ -10,7 +10,6 @@
 use Interop\Queue\PsrMessage;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\EventDispatcher\GenericEvent;
-use Symfony\Component\HttpKernel\Kernel;
 
 class PhpSerializerEventTransformerTest extends TestCase
 {
@@ -28,10 +27,6 @@ public function testCouldBeConstructedWithoutAnyArguments()
 
     public function testShouldReturnMessageWithPhpSerializedEventAsBodyOnToMessage()
     {
-        if (version_compare(Kernel::VERSION, '3.0', '<')) {
-            $this->markTestSkipped('This functionality only works on Symfony 3.0 or higher');
-        }
-
         $transformer = new PhpSerializerEventTransformer($this->createContextStub());
 
         $event = new GenericEvent('theSubject');
@@ -45,10 +40,6 @@ public function testShouldReturnMessageWithPhpSerializedEventAsBodyOnToMessage()
 
     public function testShouldReturnEventUnserializedFromMessageBodyOnToEvent()
     {
-        if (version_compare(Kernel::VERSION, '3.0', '<')) {
-            $this->markTestSkipped('This functionality only works on Symfony 3.0 or higher');
-        }
-
         $message = new NullMessage();
         $message->setBody(serialize(new GenericEvent('theSubject')));
 
@@ -60,34 +51,6 @@ public function testShouldReturnEventUnserializedFromMessageBodyOnToEvent()
         $this->assertEquals('theSubject', $event->getSubject());
     }
 
-    public function testThrowNotSupportedExceptionOnSymfonyPrior30OnToMessage()
-    {
-        if (version_compare(Kernel::VERSION, '3.0', '>=')) {
-            $this->markTestSkipped('This functionality only works on Symfony 3.0 or higher');
-        }
-
-        $this->expectException(\LogicException::class);
-        $this->expectExceptionMessage('This transformer does not work on Symfony prior 3.0.');
-
-        $transformer = new PhpSerializerEventTransformer($this->createContextStub());
-
-        $transformer->toMessage(new GenericEvent());
-    }
-
-    public function testThrowNotSupportedExceptionOnSymfonyPrior30OnToEvent()
-    {
-        if (version_compare(Kernel::VERSION, '3.0', '>=')) {
-            $this->markTestSkipped('This functionality only works on Symfony 3.0 or higher');
-        }
-
-        $this->expectException(\LogicException::class);
-        $this->expectExceptionMessage('This transformer does not work on Symfony prior 3.0.');
-
-        $transformer = new PhpSerializerEventTransformer($this->createContextStub());
-
-        $transformer->toEvent('anEvent', new NullMessage());
-    }
-
     /**
      * @return \PHPUnit_Framework_MockObject_MockObject|PsrContext
      */

From 1c8b1c3a07ad53572c2c5e149b946f34239159a3 Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Tue, 14 Aug 2018 10:38:52 +0300
Subject: [PATCH 11/61] update pkgs travis files.

---
 .travis.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index b9cf57f..9ed4fa1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,8 +6,8 @@ git:
 language: php
 
 php:
-    - '5.6'
-    - '7.0'
+    - '7.1'
+    - '7.2'
 
 cache:
     directories:

From a22dd86cc5a415549ecb863f255a2023e657c6f2 Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Thu, 30 Aug 2018 20:38:38 +0300
Subject: [PATCH 12/61] fix  cs

---
 Tests/Functional/UseCasesTest.php | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Tests/Functional/UseCasesTest.php b/Tests/Functional/UseCasesTest.php
index 1c2768d..a2926b8 100644
--- a/Tests/Functional/UseCasesTest.php
+++ b/Tests/Functional/UseCasesTest.php
@@ -12,7 +12,6 @@
 use Interop\Queue\PsrProcessor;
 use Interop\Queue\PsrQueue;
 use PHPUnit\Framework\TestCase;
-use Symfony\Component\EventDispatcher\Event;
 use Symfony\Component\EventDispatcher\EventDispatcher;
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Symfony\Component\EventDispatcher\GenericEvent;

From 810675fc9ace4314ad4602eb00aaa9ab0b7d11e3 Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Sat, 1 Sep 2018 20:48:13 +0300
Subject: [PATCH 13/61] explisitly add queue interop dev package as dep

---
 composer.json | 1 +
 1 file changed, 1 insertion(+)

diff --git a/composer.json b/composer.json
index 03055cf..1d005f0 100644
--- a/composer.json
+++ b/composer.json
@@ -8,6 +8,7 @@
     "require": {
         "php": "^7.1.3",
         "enqueue/enqueue": "0.9.x-dev",
+        "queue-interop/queue-interop": "0.7.x-dev",
         "symfony/event-dispatcher": "^3.4|^4"
     },
     "require-dev": {

From 75f365c65cafeedec1224fd51f912b1ee875782b Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Thu, 27 Sep 2018 13:56:38 +0300
Subject: [PATCH 14/61] [async-commands][async-events] Sync with latest design
 chagnes in core.

---
 AsyncProcessor.php                      | 15 +++++++--------
 Commands.php                            |  8 ++++++++
 DependencyInjection/AsyncEventsPass.php | 13 ++++++-------
 Resources/config/services.yml           |  9 ++++-----
 4 files changed, 25 insertions(+), 20 deletions(-)
 create mode 100644 Commands.php

diff --git a/AsyncProcessor.php b/AsyncProcessor.php
index a82a282..000d305 100644
--- a/AsyncProcessor.php
+++ b/AsyncProcessor.php
@@ -2,13 +2,14 @@
 
 namespace Enqueue\AsyncEventDispatcher;
 
+use Enqueue\Client\CommandSubscriberInterface;
 use Enqueue\Consumption\Result;
 use Interop\Queue\PsrContext;
 use Interop\Queue\PsrMessage;
 use Interop\Queue\PsrProcessor;
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
-class AsyncProcessor implements PsrProcessor
+class AsyncProcessor implements PsrProcessor, CommandSubscriberInterface
 {
     /**
      * @var Registry
@@ -20,10 +21,6 @@ class AsyncProcessor implements PsrProcessor
      */
     private $dispatcher;
 
-    /**
-     * @param Registry                 $registry
-     * @param EventDispatcherInterface $dispatcher
-     */
     public function __construct(Registry $registry, EventDispatcherInterface $dispatcher)
     {
         $this->registry = $registry;
@@ -39,9 +36,6 @@ public function __construct(Registry $registry, EventDispatcherInterface $dispat
         $this->dispatcher = $dispatcher;
     }
 
-    /**
-     * {@inheritdoc}
-     */
     public function process(PsrMessage $message, PsrContext $context)
     {
         if (false == $eventName = $message->getProperty('event_name')) {
@@ -57,4 +51,9 @@ public function process(PsrMessage $message, PsrContext $context)
 
         return self::ACK;
     }
+
+    public static function getSubscribedCommand()
+    {
+        return Commands::DISPATCH_ASYNC_EVENTS;
+    }
 }
diff --git a/Commands.php b/Commands.php
new file mode 100644
index 0000000..a00ed6f
--- /dev/null
+++ b/Commands.php
@@ -0,0 +1,8 @@
+<?php
+
+namespace Enqueue\AsyncEventDispatcher;
+
+final class Commands
+{
+    const DISPATCH_ASYNC_EVENTS = 'symfony.dispatch_async_events';
+}
diff --git a/DependencyInjection/AsyncEventsPass.php b/DependencyInjection/AsyncEventsPass.php
index 1db8035..702d23a 100644
--- a/DependencyInjection/AsyncEventsPass.php
+++ b/DependencyInjection/AsyncEventsPass.php
@@ -9,10 +9,7 @@
 
 class AsyncEventsPass implements CompilerPassInterface
 {
-    /**
-     * {@inheritdoc}
-     */
-    public function process(ContainerBuilder $container)
+    public function process(ContainerBuilder $container): void
     {
         if (false == $container->hasDefinition('enqueue.events.async_listener')) {
             return;
@@ -45,8 +42,9 @@ public function process(ContainerBuilder $container)
                     ;
 
                     $container->getDefinition('enqueue.events.async_processor')
-                        ->addTag('enqueue.client.processor', [
-                            'topicName' => 'event.'.$event,
+                        ->addTag('enqueue.processor', [
+                            'topic' => 'event.'.$event,
+                            'client' => 'default',
                         ])
                     ;
 
@@ -78,8 +76,9 @@ public function process(ContainerBuilder $container)
                         ;
 
                         $container->getDefinition('enqueue.events.async_processor')
-                            ->addTag('enqueue.client.processor', [
+                            ->addTag('enqueue.processor', [
                                 'topicName' => 'event.'.$event,
+                                'client' => 'default',
                             ])
                         ;
 
diff --git a/Resources/config/services.yml b/Resources/config/services.yml
index e291605..81ae3f3 100644
--- a/Resources/config/services.yml
+++ b/Resources/config/services.yml
@@ -33,11 +33,10 @@ services:
             - '@enqueue.events.event_dispatcher'
         tags:
             -
-                name: 'enqueue.client.processor'
-                topicName: '__command__'
-                processorName: '%enqueue_events_queue%'
-                queueName: '%enqueue_events_queue%'
-                queueNameHardcoded: true
+                name: 'enqueue.processor'
+                command: 'symfony.dispatch_async_events'
+                queue: '%enqueue_events_queue%'
+                queue_prefixed: false
                 exclusive: true
 
     enqueue.events.php_serializer_event_transofrmer:

From c47af4ad233e00a12f6ba52695121fa82885c32d Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Fri, 28 Sep 2018 14:06:36 +0300
Subject: [PATCH 15/61] [async-command][async-events] Do not use deprecated
 classes.

---
 AsyncListener.php                           | 18 +++++++++---------
 AsyncProcessor.php                          | 10 +++++-----
 EventTransformer.php                        | 14 +++++++-------
 PhpSerializerEventTransformer.php           | 12 ++++++------
 Tests/AsyncListenerTest.php                 | 14 +++++++-------
 Tests/AsyncProcessorTest.php                |  4 ++--
 Tests/Functional/UseCasesTest.php           | 16 ++++++++--------
 Tests/PhpSerializerEventTransformerTest.php | 10 +++++-----
 8 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/AsyncListener.php b/AsyncListener.php
index 524fdb2..54f4cf2 100644
--- a/AsyncListener.php
+++ b/AsyncListener.php
@@ -2,14 +2,14 @@
 
 namespace Enqueue\AsyncEventDispatcher;
 
-use Interop\Queue\PsrContext;
-use Interop\Queue\PsrQueue;
+use Interop\Queue\Context;
+use Interop\Queue\Queue;
 use Symfony\Component\EventDispatcher\Event;
 
 class AsyncListener
 {
     /**
-     * @var PsrContext
+     * @var Context
      */
     private $context;
 
@@ -19,7 +19,7 @@ class AsyncListener
     private $registry;
 
     /**
-     * @var PsrQueue
+     * @var Queue
      */
     private $eventQueue;
 
@@ -29,15 +29,15 @@ class AsyncListener
     private $syncMode;
 
     /**
-     * @param PsrContext      $context
-     * @param Registry        $registry
-     * @param PsrQueue|string $eventQueue
+     * @param Context      $context
+     * @param Registry     $registry
+     * @param Queue|string $eventQueue
      */
-    public function __construct(PsrContext $context, Registry $registry, $eventQueue)
+    public function __construct(Context $context, Registry $registry, $eventQueue)
     {
         $this->context = $context;
         $this->registry = $registry;
-        $this->eventQueue = $eventQueue instanceof PsrQueue ? $eventQueue : $context->createQueue($eventQueue);
+        $this->eventQueue = $eventQueue instanceof Queue ? $eventQueue : $context->createQueue($eventQueue);
     }
 
     public function __invoke(Event $event, $eventName)
diff --git a/AsyncProcessor.php b/AsyncProcessor.php
index 000d305..3f57807 100644
--- a/AsyncProcessor.php
+++ b/AsyncProcessor.php
@@ -4,12 +4,12 @@
 
 use Enqueue\Client\CommandSubscriberInterface;
 use Enqueue\Consumption\Result;
-use Interop\Queue\PsrContext;
-use Interop\Queue\PsrMessage;
-use Interop\Queue\PsrProcessor;
+use Interop\Queue\Context;
+use Interop\Queue\Message;
+use Interop\Queue\Processor;
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
-class AsyncProcessor implements PsrProcessor, CommandSubscriberInterface
+class AsyncProcessor implements Processor, CommandSubscriberInterface
 {
     /**
      * @var Registry
@@ -36,7 +36,7 @@ public function __construct(Registry $registry, EventDispatcherInterface $dispat
         $this->dispatcher = $dispatcher;
     }
 
-    public function process(PsrMessage $message, PsrContext $context)
+    public function process(Message $message, Context $context)
     {
         if (false == $eventName = $message->getProperty('event_name')) {
             return Result::reject('The message is missing "event_name" property');
diff --git a/EventTransformer.php b/EventTransformer.php
index 4aa2360..6b6aa0f 100644
--- a/EventTransformer.php
+++ b/EventTransformer.php
@@ -2,7 +2,7 @@
 
 namespace Enqueue\AsyncEventDispatcher;
 
-use Interop\Queue\PsrMessage;
+use Interop\Queue\Message;
 use Symfony\Component\EventDispatcher\Event;
 
 interface EventTransformer
@@ -11,19 +11,19 @@ interface EventTransformer
      * @param string     $eventName
      * @param Event|null $event
      *
-     * @return PsrMessage
+     * @return Message
      */
     public function toMessage($eventName, Event $event);
 
     /**
      * If you able to transform message back to event return it.
-     * If you failed to transform for some reason you can return a string status (@see PsrProcess constants) or an object that implements __toString method.
-     * The object must have a __toString method is supposed to be used as PsrProcessor::process return value.
+     * If you failed to transform for some reason you can return a string status (@see Process constants) or an object that implements __toString method.
+     * The object must have a __toString method is supposed to be used as Processor::process return value.
      *
-     * @param string     $eventName
-     * @param PsrMessage $message
+     * @param string  $eventName
+     * @param Message $message
      *
      * @return Event|string|object
      */
-    public function toEvent($eventName, PsrMessage $message);
+    public function toEvent($eventName, Message $message);
 }
diff --git a/PhpSerializerEventTransformer.php b/PhpSerializerEventTransformer.php
index 0b9e347..34392c4 100644
--- a/PhpSerializerEventTransformer.php
+++ b/PhpSerializerEventTransformer.php
@@ -2,21 +2,21 @@
 
 namespace Enqueue\AsyncEventDispatcher;
 
-use Interop\Queue\PsrContext;
-use Interop\Queue\PsrMessage;
+use Interop\Queue\Context;
+use Interop\Queue\Message;
 use Symfony\Component\EventDispatcher\Event;
 
 class PhpSerializerEventTransformer implements EventTransformer
 {
     /**
-     * @var PsrContext
+     * @var Context
      */
     private $context;
 
     /**
-     * @param PsrContext $context
+     * @param Context $context
      */
-    public function __construct(PsrContext $context)
+    public function __construct(Context $context)
     {
         $this->context = $context;
     }
@@ -32,7 +32,7 @@ public function toMessage($eventName, Event $event = null)
     /**
      * {@inheritdoc}
      */
-    public function toEvent($eventName, PsrMessage $message)
+    public function toEvent($eventName, Message $message)
     {
         return unserialize($message->getBody());
     }
diff --git a/Tests/AsyncListenerTest.php b/Tests/AsyncListenerTest.php
index c3e6c0a..6e019f6 100644
--- a/Tests/AsyncListenerTest.php
+++ b/Tests/AsyncListenerTest.php
@@ -8,8 +8,8 @@
 use Enqueue\Null\NullMessage;
 use Enqueue\Null\NullQueue;
 use Enqueue\Test\ClassExtensionTrait;
-use Interop\Queue\PsrContext;
-use Interop\Queue\PsrProducer;
+use Interop\Queue\Context;
+use Interop\Queue\Producer;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\EventDispatcher\Event;
 use Symfony\Component\EventDispatcher\GenericEvent;
@@ -35,7 +35,7 @@ public function testCouldBeConstructedWithContextAndRegistryAndEventQueueAsStrin
         $this->assertAttributeSame($eventQueue, 'eventQueue', $listener);
     }
 
-    public function testCouldBeConstructedWithContextAndRegistryAndPsrQueue()
+    public function testCouldBeConstructedWithContextAndRegistryAndQueue()
     {
         $eventQueue = new NullQueue('symfony_events');
 
@@ -137,19 +137,19 @@ private function createEventTransformerMock()
     }
 
     /**
-     * @return \PHPUnit_Framework_MockObject_MockObject|PsrProducer
+     * @return \PHPUnit_Framework_MockObject_MockObject|Producer
      */
     private function createProducerMock()
     {
-        return $this->createMock(PsrProducer::class);
+        return $this->createMock(Producer::class);
     }
 
     /**
-     * @return \PHPUnit_Framework_MockObject_MockObject|PsrContext
+     * @return \PHPUnit_Framework_MockObject_MockObject|Context
      */
     private function createContextMock()
     {
-        return $this->createMock(PsrContext::class);
+        return $this->createMock(Context::class);
     }
 
     /**
diff --git a/Tests/AsyncProcessorTest.php b/Tests/AsyncProcessorTest.php
index 9502908..334022e 100644
--- a/Tests/AsyncProcessorTest.php
+++ b/Tests/AsyncProcessorTest.php
@@ -10,7 +10,7 @@
 use Enqueue\Null\NullContext;
 use Enqueue\Null\NullMessage;
 use Enqueue\Test\ClassExtensionTrait;
-use Interop\Queue\PsrProcessor;
+use Interop\Queue\Processor;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\EventDispatcher\GenericEvent;
 
@@ -20,7 +20,7 @@ class AsyncProcessorTest extends TestCase
 
     public function testShouldImplementProcessorInterface()
     {
-        $this->assertClassImplements(PsrProcessor::class, AsyncProcessor::class);
+        $this->assertClassImplements(Processor::class, AsyncProcessor::class);
     }
 
     public function testCouldBeConstructedWithRegistryAndProxyEventDispatcher()
diff --git a/Tests/Functional/UseCasesTest.php b/Tests/Functional/UseCasesTest.php
index a2926b8..e384885 100644
--- a/Tests/Functional/UseCasesTest.php
+++ b/Tests/Functional/UseCasesTest.php
@@ -8,9 +8,9 @@
 use Enqueue\AsyncEventDispatcher\SimpleRegistry;
 use Enqueue\Bundle\Tests\Functional\App\TestAsyncEventTransformer;
 use Enqueue\Fs\FsConnectionFactory;
-use Interop\Queue\PsrContext;
-use Interop\Queue\PsrProcessor;
-use Interop\Queue\PsrQueue;
+use Interop\Queue\Context;
+use Interop\Queue\Processor;
+use Interop\Queue\Queue;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\EventDispatcher\EventDispatcher;
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -23,12 +23,12 @@
 class UseCasesTest extends TestCase
 {
     /**
-     * @var PsrContext
+     * @var Context
      */
     protected $context;
 
     /**
-     * @var PsrQueue
+     * @var Queue
      */
     protected $queue;
 
@@ -184,13 +184,13 @@ private function processMessages()
             $result = $this->asyncProcessor->process($message, $this->context);
 
             switch ((string) $result) {
-                case PsrProcessor::ACK:
+                case Processor::ACK:
                     $consumer->acknowledge($message);
                     break;
-                case PsrProcessor::REJECT:
+                case Processor::REJECT:
                     $consumer->reject($message);
                     break;
-                case PsrProcessor::REQUEUE:
+                case Processor::REQUEUE:
                     $consumer->reject($message, true);
                     break;
                 default:
diff --git a/Tests/PhpSerializerEventTransformerTest.php b/Tests/PhpSerializerEventTransformerTest.php
index ee89d92..8e9ee81 100644
--- a/Tests/PhpSerializerEventTransformerTest.php
+++ b/Tests/PhpSerializerEventTransformerTest.php
@@ -6,8 +6,8 @@
 use Enqueue\AsyncEventDispatcher\PhpSerializerEventTransformer;
 use Enqueue\Null\NullMessage;
 use Enqueue\Test\ClassExtensionTrait;
-use Interop\Queue\PsrContext;
-use Interop\Queue\PsrMessage;
+use Interop\Queue\Context;
+use Interop\Queue\Message;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\EventDispatcher\GenericEvent;
 
@@ -34,7 +34,7 @@ public function testShouldReturnMessageWithPhpSerializedEventAsBodyOnToMessage()
 
         $message = $transformer->toMessage('fooEvent', $event);
 
-        $this->assertInstanceOf(PsrMessage::class, $message);
+        $this->assertInstanceOf(Message::class, $message);
         $this->assertEquals($expectedBody, $message->getBody());
     }
 
@@ -52,11 +52,11 @@ public function testShouldReturnEventUnserializedFromMessageBodyOnToEvent()
     }
 
     /**
-     * @return \PHPUnit_Framework_MockObject_MockObject|PsrContext
+     * @return \PHPUnit_Framework_MockObject_MockObject|Context
      */
     private function createContextStub()
     {
-        $context = $this->createMock(PsrContext::class);
+        $context = $this->createMock(Context::class);
         $context
             ->expects($this->any())
             ->method('createMessage')

From 804c48b5457db94b92950530423e12a15feaeeb9 Mon Sep 17 00:00:00 2001
From: webmake <webmake@users.noreply.github.com>
Date: Sat, 27 Oct 2018 10:56:55 +0000
Subject: [PATCH 16/61] Do not export non source files

---
 .gitattributes | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 .gitattributes

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..bdf2dcb
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,5 @@
+/Tests export-ignore
+.gitattributes export-ignore
+.gitignore export-ignore
+.travis.yml export-ignore
+phpunit.xml.dist export-ignore

From 09d1c8dcaa847065e9968baba34aa49b14e6ac97 Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Tue, 6 Nov 2018 18:06:13 +0200
Subject: [PATCH 17/61] [doc][skip ci] Add sponsoring section.

---
 README.md | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/README.md b/README.md
index 4e8f2ce..770f003 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,12 @@
+<h2 align="center">Supporting Enqueue</h2>
+
+Enqueue is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:
+
+- [Become a sponsor](https://www.patreon.com/makasim).
+- [Become our client](http://forma-pro.com/)
+
+---
+
 # Symfony Async Event Dispatcher.
 
 [![Gitter](https://badges.gitter.im/php-enqueue/Lobby.svg)](https://gitter.im/php-enqueue/Lobby)

From 57678d0d40d695ba5bbeeccf7fbebf4e13351713 Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Tue, 6 Nov 2018 18:12:08 +0200
Subject: [PATCH 18/61] [docs][skip ci] Add sponsoring to docs.

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 770f003..8554df7 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
 
 Enqueue is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our customers. If you'd like to join them, please consider:
 
-- [Become a sponsor](https://www.patreon.com/makasim).
+- [Become a sponsor](https://www.patreon.com/makasim)
 - [Become our client](http://forma-pro.com/)
 
 ---

From 7d927c3bd633dc6c71b92536b14f3a7323f8c69b Mon Sep 17 00:00:00 2001
From: Alexander Kozienko <a.s.kozienko@gmail.com>
Date: Fri, 16 Nov 2018 13:52:04 +0200
Subject: [PATCH 19/61] multi client configuration

---
 DependencyInjection/AsyncEventsPass.php | 6 ++++--
 composer.json                           | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/DependencyInjection/AsyncEventsPass.php b/DependencyInjection/AsyncEventsPass.php
index 702d23a..5371eb8 100644
--- a/DependencyInjection/AsyncEventsPass.php
+++ b/DependencyInjection/AsyncEventsPass.php
@@ -19,6 +19,8 @@ public function process(ContainerBuilder $container): void
             return;
         }
 
+        $defaultClient = $container->getParameter('enqueue.default_client');
+
         $registeredToEvent = [];
         foreach ($container->findTaggedServiceIds('kernel.event_listener') as $serviceId => $tagAttributes) {
             foreach ($tagAttributes as $tagAttribute) {
@@ -44,7 +46,7 @@ public function process(ContainerBuilder $container): void
                     $container->getDefinition('enqueue.events.async_processor')
                         ->addTag('enqueue.processor', [
                             'topic' => 'event.'.$event,
-                            'client' => 'default',
+                            'client' => $defaultClient,
                         ])
                     ;
 
@@ -78,7 +80,7 @@ public function process(ContainerBuilder $container): void
                         $container->getDefinition('enqueue.events.async_processor')
                             ->addTag('enqueue.processor', [
                                 'topicName' => 'event.'.$event,
-                                'client' => 'default',
+                                'client' => $defaultClient,
                             ])
                         ;
 
diff --git a/composer.json b/composer.json
index 1d005f0..2c9d253 100644
--- a/composer.json
+++ b/composer.json
@@ -8,7 +8,7 @@
     "require": {
         "php": "^7.1.3",
         "enqueue/enqueue": "0.9.x-dev",
-        "queue-interop/queue-interop": "0.7.x-dev",
+        "queue-interop/queue-interop": "^0.7",
         "symfony/event-dispatcher": "^3.4|^4"
     },
     "require-dev": {

From 203b1682bbcb264b0a0304d14a4083746013005f Mon Sep 17 00:00:00 2001
From: webmake <nyrkao@gmail.com>
Date: Sat, 27 Oct 2018 13:56:55 +0300
Subject: [PATCH 20/61] Do not export non source files

(cherry picked from commit 404fae1)
---
 .gitattributes | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 .gitattributes

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..bdf2dcb
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,5 @@
+/Tests export-ignore
+.gitattributes export-ignore
+.gitignore export-ignore
+.travis.yml export-ignore
+phpunit.xml.dist export-ignore

From 05f2020111c204fefdad19823504cf33026cc89d Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Tue, 27 Nov 2018 19:54:18 +0200
Subject: [PATCH 21/61] Allow installing stable dependencies.

---
 composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index 2c9d253..ca63adf 100644
--- a/composer.json
+++ b/composer.json
@@ -7,7 +7,7 @@
     "license": "MIT",
     "require": {
         "php": "^7.1.3",
-        "enqueue/enqueue": "0.9.x-dev",
+        "enqueue/enqueue": "^0.9",
         "queue-interop/queue-interop": "^0.7",
         "symfony/event-dispatcher": "^3.4|^4"
     },

From 84055d8ed82ef7337ff4bd9295772bad9c2eff5b Mon Sep 17 00:00:00 2001
From: Kotlyar Maksim <kotlyar.maksim@gmail.com>
Date: Thu, 13 Dec 2018 17:31:01 +0200
Subject: [PATCH 22/61] Allow queue interop 0.8 in packages

---
 composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index ca63adf..d5996f4 100644
--- a/composer.json
+++ b/composer.json
@@ -8,7 +8,7 @@
     "require": {
         "php": "^7.1.3",
         "enqueue/enqueue": "^0.9",
-        "queue-interop/queue-interop": "^0.7",
+        "queue-interop/queue-interop": "^0.7|^0.8",
         "symfony/event-dispatcher": "^3.4|^4"
     },
     "require-dev": {

From 0c2d376344048474b1617dcc8a10d73704a6fd6a Mon Sep 17 00:00:00 2001
From: Jo Carter <github@jocarter.co.uk>
Date: Fri, 14 Dec 2018 12:15:30 +0000
Subject: [PATCH 23/61] Fix TreeBuilder in Symfony 4.2

A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.
---
 DependencyInjection/Configuration.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 9703e62..51c94b6 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -12,8 +12,8 @@ class Configuration implements ConfigurationInterface
      */
     public function getConfigTreeBuilder()
     {
-        $tb = new TreeBuilder();
-        $rootNode = $tb->root('enqueue_async_event_dispatcher');
+        $tb = new TreeBuilder('enqueue_async_event_dispatcher');
+        $rootNode = $tb->getRootNode();
 
         $rootNode->children()
             ->scalarNode('context_service')->isRequired()->cannotBeEmpty()->end()

From 9a63680923a7cfd8eb0ae0eb937b3b646e5c1794 Mon Sep 17 00:00:00 2001
From: Jo Carter <github@jocarter.co.uk>
Date: Fri, 14 Dec 2018 12:27:16 +0000
Subject: [PATCH 24/61] BC fix.

---
 DependencyInjection/Configuration.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 51c94b6..2deb06a 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -13,7 +13,12 @@ class Configuration implements ConfigurationInterface
     public function getConfigTreeBuilder()
     {
         $tb = new TreeBuilder('enqueue_async_event_dispatcher');
-        $rootNode = $tb->getRootNode();
+
+        if (method_exists($tb, 'getRootNode')) {
+            $rootNode = $tb->getRootNode();
+        } else {
+            $rootNode = $tb->root('enqueue_async_event_dispatcher');
+        }
 
         $rootNode->children()
             ->scalarNode('context_service')->isRequired()->cannotBeEmpty()->end()

From aa77ead24073987d6deb414826b2457cfa8273cb Mon Sep 17 00:00:00 2001
From: Jo Carter <github@jocarter.co.uk>
Date: Fri, 14 Dec 2018 13:03:59 +0000
Subject: [PATCH 25/61] Further BC fix

---
 DependencyInjection/Configuration.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 2deb06a..56151e9 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -12,11 +12,11 @@ class Configuration implements ConfigurationInterface
      */
     public function getConfigTreeBuilder()
     {
-        $tb = new TreeBuilder('enqueue_async_event_dispatcher');
-
-        if (method_exists($tb, 'getRootNode')) {
+        if (method_exists(TreeBuilder::class, 'getRootNode')) {
+            $tb = new TreeBuilder('enqueue_async_event_dispatcher');
             $rootNode = $tb->getRootNode();
         } else {
+            $tb = new TreeBuilder();
             $rootNode = $tb->root('enqueue_async_event_dispatcher');
         }
 

From 8c43942dd347a5dd6a6260a295e6cedc11f0422d Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Sat, 15 Dec 2018 22:34:44 +0200
Subject: [PATCH 26/61] [async-events] Remove command subscriber interface.

---
 AsyncProcessor.php | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/AsyncProcessor.php b/AsyncProcessor.php
index 3f57807..c89f7e1 100644
--- a/AsyncProcessor.php
+++ b/AsyncProcessor.php
@@ -2,14 +2,13 @@
 
 namespace Enqueue\AsyncEventDispatcher;
 
-use Enqueue\Client\CommandSubscriberInterface;
 use Enqueue\Consumption\Result;
 use Interop\Queue\Context;
 use Interop\Queue\Message;
 use Interop\Queue\Processor;
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 
-class AsyncProcessor implements Processor, CommandSubscriberInterface
+class AsyncProcessor implements Processor
 {
     /**
      * @var Registry
@@ -51,9 +50,4 @@ public function process(Message $message, Context $context)
 
         return self::ACK;
     }
-
-    public static function getSubscribedCommand()
-    {
-        return Commands::DISPATCH_ASYNC_EVENTS;
-    }
 }

From fe6e9d61abe11b828c691a5927ec0539bd3cf0e5 Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Sat, 15 Dec 2018 22:46:41 +0200
Subject: [PATCH 27/61] add transport processor tag.

---
 .../AsyncEventDispatcherExtension.php          | 18 +++++++++++++++---
 Resources/config/services.yml                  | 14 --------------
 2 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/DependencyInjection/AsyncEventDispatcherExtension.php b/DependencyInjection/AsyncEventDispatcherExtension.php
index b2ec12f..8cb79ee 100644
--- a/DependencyInjection/AsyncEventDispatcherExtension.php
+++ b/DependencyInjection/AsyncEventDispatcherExtension.php
@@ -2,17 +2,17 @@
 
 namespace Enqueue\AsyncEventDispatcher\DependencyInjection;
 
+use Enqueue\AsyncEventDispatcher\AsyncProcessor;
+use Enqueue\AsyncEventDispatcher\Commands;
 use Symfony\Component\Config\FileLocator;
 use Symfony\Component\DependencyInjection\Alias;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\DependencyInjection\Extension\Extension;
 use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
+use Symfony\Component\DependencyInjection\Reference;
 
 class AsyncEventDispatcherExtension extends Extension
 {
-    /**
-     * {@inheritdoc}
-     */
     public function load(array $configs, ContainerBuilder $container)
     {
         $config = $this->processConfiguration(new Configuration(), $configs);
@@ -21,5 +21,17 @@ public function load(array $configs, ContainerBuilder $container)
 
         $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
         $loader->load('services.yml');
+
+        $container->register('enqueue.events.async_processor', AsyncProcessor::class)
+            ->addArgument(new Reference('enqueue.events.registry'))
+            ->addArgument(new Reference('enqueue.events.event_dispatcher'))
+            ->addTag('enqueue.processor', [
+                'command' => Commands::DISPATCH_ASYNC_EVENTS,
+                'queue' => '%enqueue_events_queue%',
+                'queue_prefixed' => false,
+                'exclusive' => true,
+            ])
+            ->addTag('enqueue.transport.processor')
+        ;
     }
 }
diff --git a/Resources/config/services.yml b/Resources/config/services.yml
index 81ae3f3..2cef527 100644
--- a/Resources/config/services.yml
+++ b/Resources/config/services.yml
@@ -25,20 +25,6 @@ services:
             - '@event_dispatcher'
             - '@enqueue.events.async_listener'
 
-    enqueue.events.async_processor:
-        class: 'Enqueue\AsyncEventDispatcher\AsyncProcessor'
-        public: public
-        arguments:
-            - '@enqueue.events.registry'
-            - '@enqueue.events.event_dispatcher'
-        tags:
-            -
-                name: 'enqueue.processor'
-                command: 'symfony.dispatch_async_events'
-                queue: '%enqueue_events_queue%'
-                queue_prefixed: false
-                exclusive: true
-
     enqueue.events.php_serializer_event_transofrmer:
         class: 'Enqueue\AsyncEventDispatcher\PhpSerializerEventTransformer'
         public: public

From 6c51b7bd7d462311a1562b455170423142c3eba9 Mon Sep 17 00:00:00 2001
From: GCalmels <gabriel@kinoba.fr>
Date: Mon, 7 Jan 2019 14:24:31 +0100
Subject: [PATCH 28/61] Fix async command/event pkgs

---
 DependencyInjection/AsyncEventDispatcherExtension.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/DependencyInjection/AsyncEventDispatcherExtension.php b/DependencyInjection/AsyncEventDispatcherExtension.php
index 8cb79ee..0b16ca6 100644
--- a/DependencyInjection/AsyncEventDispatcherExtension.php
+++ b/DependencyInjection/AsyncEventDispatcherExtension.php
@@ -28,7 +28,7 @@ public function load(array $configs, ContainerBuilder $container)
             ->addTag('enqueue.processor', [
                 'command' => Commands::DISPATCH_ASYNC_EVENTS,
                 'queue' => '%enqueue_events_queue%',
-                'queue_prefixed' => false,
+                'prefix_queue' => false,
                 'exclusive' => true,
             ])
             ->addTag('enqueue.transport.processor')

From a91a3edee56f71247ef9182f9b5aba15b9aa13ef Mon Sep 17 00:00:00 2001
From: Samuel NELA <hello@samnela.com>
Date: Mon, 21 Jan 2019 14:01:06 +0100
Subject: [PATCH 29/61] Fixed param on EventTransformer

---
 EventTransformer.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/EventTransformer.php b/EventTransformer.php
index 6b6aa0f..abb6756 100644
--- a/EventTransformer.php
+++ b/EventTransformer.php
@@ -13,7 +13,7 @@ interface EventTransformer
      *
      * @return Message
      */
-    public function toMessage($eventName, Event $event);
+    public function toMessage($eventName, Event $event = null);
 
     /**
      * If you able to transform message back to event return it.

From ef3ca6bf90ebeba876ce2334067a59b3163ea47c Mon Sep 17 00:00:00 2001
From: GCalmels <gabriel@kinoba.fr>
Date: Fri, 1 Feb 2019 09:06:16 +0100
Subject: [PATCH 30/61] Add default to php_serializer_event_transformer

---
 DependencyInjection/AsyncTransformersPass.php | 14 ++++++++++++--
 Resources/config/services.yml                 |  4 ++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/DependencyInjection/AsyncTransformersPass.php b/DependencyInjection/AsyncTransformersPass.php
index 0adcfcb..dfd457e 100644
--- a/DependencyInjection/AsyncTransformersPass.php
+++ b/DependencyInjection/AsyncTransformersPass.php
@@ -18,6 +18,7 @@ public function process(ContainerBuilder $container)
 
         $transformerIdsMap = [];
         $eventNamesMap = [];
+        $defaultTransformer = null;
         foreach ($container->findTaggedServiceIds('enqueue.event_transformer') as $serviceId => $tagAttributes) {
             foreach ($tagAttributes as $tagAttribute) {
                 if (false == isset($tagAttribute['eventName'])) {
@@ -28,11 +29,20 @@ public function process(ContainerBuilder $container)
 
                 $transformerName = isset($tagAttribute['transformerName']) ? $tagAttribute['transformerName'] : $serviceId;
 
-                $eventNamesMap[$eventName] = $transformerName;
-                $transformerIdsMap[$transformerName] = $serviceId;
+                if (isset($tagAttribute['default']) && $tagAttribute['default']) {
+                    $defaultTransformer = ['id' => $serviceId, 'transformerName' => $transformerName];
+                } else {
+                    $eventNamesMap[] = $transformerName;
+                    $transformerIdsMap[] = $serviceId;
+                }
             }
         }
 
+        if ($defaultTransformer) {
+            $eventNamesMap[] = $defaultTransformer['transformerName'];
+            $transformerIdsMap[] = $defaultTransformer['id'];
+        }
+
         $container->getDefinition('enqueue.events.registry')
             ->replaceArgument(0, $eventNamesMap)
             ->replaceArgument(1, $transformerIdsMap)
diff --git a/Resources/config/services.yml b/Resources/config/services.yml
index 2cef527..2b3fbc0 100644
--- a/Resources/config/services.yml
+++ b/Resources/config/services.yml
@@ -25,10 +25,10 @@ services:
             - '@event_dispatcher'
             - '@enqueue.events.async_listener'
 
-    enqueue.events.php_serializer_event_transofrmer:
+    enqueue.events.php_serializer_event_transformer:
         class: 'Enqueue\AsyncEventDispatcher\PhpSerializerEventTransformer'
         public: public
         arguments:
             - '@enqueue.events.context'
         tags:
-            - {name: 'enqueue.event_transformer', eventName: '/.*/', transformerName: 'php_serializer' }
+            - {name: 'enqueue.event_transformer', eventName: '/.*/', transformerName: 'php_serializer', default: true }

From f2709b017034e59967a3348728189f6a800bc482 Mon Sep 17 00:00:00 2001
From: GCalmels <gabriel@kinoba.fr>
Date: Fri, 1 Feb 2019 10:04:23 +0100
Subject: [PATCH 31/61] Fix error with eventName in AsyncTransformersPass.php

---
 DependencyInjection/AsyncTransformersPass.php | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/DependencyInjection/AsyncTransformersPass.php b/DependencyInjection/AsyncTransformersPass.php
index dfd457e..d93b597 100644
--- a/DependencyInjection/AsyncTransformersPass.php
+++ b/DependencyInjection/AsyncTransformersPass.php
@@ -30,17 +30,21 @@ public function process(ContainerBuilder $container)
                 $transformerName = isset($tagAttribute['transformerName']) ? $tagAttribute['transformerName'] : $serviceId;
 
                 if (isset($tagAttribute['default']) && $tagAttribute['default']) {
-                    $defaultTransformer = ['id' => $serviceId, 'transformerName' => $transformerName];
+                    $defaultTransformer = [
+                        'id' => $serviceId,
+                        'transformerName' => $transformerName,
+                        'eventName' => $eventName
+                    ];
                 } else {
-                    $eventNamesMap[] = $transformerName;
-                    $transformerIdsMap[] = $serviceId;
+                    $eventNamesMap[$eventName] = $transformerName;
+                    $transformerIdsMap[$transformerName] = $serviceId;
                 }
             }
         }
 
         if ($defaultTransformer) {
-            $eventNamesMap[] = $defaultTransformer['transformerName'];
-            $transformerIdsMap[] = $defaultTransformer['id'];
+            $eventNamesMap[$defaultTransformer['eventName']] = $defaultTransformer['transformerName'];
+            $transformerIdsMap[$defaultTransformer['transformerName']] = $defaultTransformer['id'];
         }
 
         $container->getDefinition('enqueue.events.registry')

From 2811170451597530300f7d3cacb840c56e2e5052 Mon Sep 17 00:00:00 2001
From: GCalmels <gabriel@kinoba.fr>
Date: Fri, 1 Feb 2019 10:51:39 +0100
Subject: [PATCH 32/61] Add comma to array last element to fix php fixer

---
 DependencyInjection/AsyncTransformersPass.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/DependencyInjection/AsyncTransformersPass.php b/DependencyInjection/AsyncTransformersPass.php
index d93b597..afe1021 100644
--- a/DependencyInjection/AsyncTransformersPass.php
+++ b/DependencyInjection/AsyncTransformersPass.php
@@ -33,7 +33,7 @@ public function process(ContainerBuilder $container)
                     $defaultTransformer = [
                         'id' => $serviceId,
                         'transformerName' => $transformerName,
-                        'eventName' => $eventName
+                        'eventName' => $eventName,
                     ];
                 } else {
                     $eventNamesMap[$eventName] = $transformerName;

From cdc441069ce819a3b8a0a2f35a3a694e05a6aa35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= <pawel@niedzielski.biz.pl>
Date: Mon, 27 May 2019 15:12:22 +0200
Subject: [PATCH 33/61] Prefer github pages in packages' readme files

---
 README.md | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index 8554df7..7e7fdc0 100644
--- a/README.md
+++ b/README.md
@@ -13,21 +13,21 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
 [![Build Status](https://travis-ci.org/php-enqueue/async-event-dispathcer.png?branch=master)](https://travis-ci.org/php-enqueue/async-event-dispathcer)
 [![Total Downloads](https://poser.pugx.org/enqueue/async-event-dispathcer/d/total.png)](https://packagist.org/packages/enqueue/async-event-dispathcer)
 [![Latest Stable Version](https://poser.pugx.org/enqueue/async-event-dispathcer/version.png)](https://packagist.org/packages/enqueue/async-event-dispathcer)
- 
-It contains an extension to Symfony's [EventDispatcher](https://symfony.com/doc/current/components/event_dispatcher.html) component. 
-It allows to processes events in background by sending them to MQ.  
+
+It contains an extension to Symfony's [EventDispatcher](https://symfony.com/doc/current/components/event_dispatcher.html) component.
+It allows to processes events in background by sending them to MQ.
 
 ## Resources
 
 * [Site](https://enqueue.forma-pro.com/)
-* [Documentation](https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md)
+* [Documentation](https://php-enqueue.github.com/)
 * [Questions](https://gitter.im/php-enqueue/Lobby)
 * [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)
 
 ## Developed by Forma-Pro
 
-Forma-Pro is a full stack development company which interests also spread to open source development. 
-Being a team of strong professionals we have an aim an ability to help community by developing cutting edge solutions in the areas of e-commerce, docker & microservice oriented architecture where we have accumulated a huge many-years experience. 
+Forma-Pro is a full stack development company which interests also spread to open source development.
+Being a team of strong professionals we have an aim an ability to help community by developing cutting edge solutions in the areas of e-commerce, docker & microservice oriented architecture where we have accumulated a huge many-years experience.
 Our main specialization is Symfony framework based solution, but we are always looking to the technologies that allow us to do our job the best way. We are committed to creating solutions that revolutionize the way how things are developed in aspects of architecture & scalability.
 
 If you have any questions and inquires about our open source development, this product particularly or any other matter feel free to contact at opensource@forma-pro.com

From 3d767fb844d0d6da6881df52db78b9f597384efb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?= <pawel@niedzielski.biz.pl>
Date: Wed, 29 May 2019 17:08:39 +0200
Subject: [PATCH 34/61] Fix documentation links

Whoops.
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 7e7fdc0..93cee30 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ It allows to processes events in background by sending them to MQ.
 ## Resources
 
 * [Site](https://enqueue.forma-pro.com/)
-* [Documentation](https://php-enqueue.github.com/)
+* [Documentation](https://php-enqueue.github.io/)
 * [Questions](https://gitter.im/php-enqueue/Lobby)
 * [Issue Tracker](https://github.com/php-enqueue/enqueue-dev/issues)
 

From db28199af73bbaf0abbbfecd440e1fb5228374a3 Mon Sep 17 00:00:00 2001
From: Jeroeny <spee.jeroen@gmail.com>
Date: Sat, 23 Nov 2019 11:31:39 +0100
Subject: [PATCH 35/61] allow symfony 5

---
 composer.json | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/composer.json b/composer.json
index d5996f4..56c2208 100644
--- a/composer.json
+++ b/composer.json
@@ -9,14 +9,14 @@
         "php": "^7.1.3",
         "enqueue/enqueue": "^0.9",
         "queue-interop/queue-interop": "^0.7|^0.8",
-        "symfony/event-dispatcher": "^3.4|^4"
+        "symfony/event-dispatcher": "^3.4|^4|^5"
     },
     "require-dev": {
         "phpunit/phpunit": "~5.5",
-        "symfony/dependency-injection": "^3.4|^4",
-        "symfony/config": "^3.4|^4",
-        "symfony/http-kernel": "^3.4|^4",
-        "symfony/filesystem": "^3.4|^4",
+        "symfony/dependency-injection": "^3.4|^4|^5",
+        "symfony/config": "^3.4|^4|^5",
+        "symfony/http-kernel": "^3.4|^4|^5",
+        "symfony/filesystem": "^3.4|^4|^5",
         "enqueue/null": "0.9.x-dev",
         "enqueue/fs": "0.9.x-dev",
         "enqueue/test": "0.9.x-dev"
@@ -29,7 +29,7 @@
         "docs": "https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md"
     },
     "suggest": {
-        "symfony/dependency-injection": "^2.8|^3|^4 If you'd like to use async event dispatcher container extension."
+        "symfony/dependency-injection": "^2.8|^3|^4|^5 If you'd like to use async event dispatcher container extension."
     },
     "autoload": {
         "psr-4": { "Enqueue\\AsyncEventDispatcher\\": "" },

From a9cdbf5183c1ee44f5207ee79b12c36f353ab287 Mon Sep 17 00:00:00 2001
From: Mathieu Lemoine <mathieu@doctoome.com>
Date: Wed, 11 Dec 2019 16:32:12 +0100
Subject: [PATCH 36/61] Reduced dependency to voryx/Thruway

---
 AbstractAsyncEventDispatcher.php            |  50 ++++++++
 AbstractAsyncListener.php                   |  65 ++++++++++
 AbstractPhpSerializerEventTransformer.php   |  33 +++++
 AsyncEventDispatcher.php                    |  82 +++++++-----
 AsyncListener.php                           | 130 +++++++++++---------
 EventTransformer.php                        |  94 +++++++++++---
 PhpSerializerEventTransformer.php           |  52 +++++---
 Tests/AsyncListenerTest.php                 |  15 ++-
 Tests/AsyncProcessorTest.php                |   7 +-
 Tests/Functional/UseCasesTest.php           |  27 ++--
 Tests/PhpSerializerEventTransformerTest.php |   3 +-
 Tests/ProxyEventDispatcherTest.php          |  13 +-
 composer.json                               |   3 +-
 phpunit.xml.dist                            |   1 -
 14 files changed, 425 insertions(+), 150 deletions(-)
 create mode 100644 AbstractAsyncEventDispatcher.php
 create mode 100644 AbstractAsyncListener.php
 create mode 100644 AbstractPhpSerializerEventTransformer.php

diff --git a/AbstractAsyncEventDispatcher.php b/AbstractAsyncEventDispatcher.php
new file mode 100644
index 0000000..c1feb02
--- /dev/null
+++ b/AbstractAsyncEventDispatcher.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace Enqueue\AsyncEventDispatcher;
+
+use Symfony\Component\EventDispatcher\Event;
+use Symfony\Component\EventDispatcher\EventDispatcher;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
+
+abstract class AbstractAsyncEventDispatcher extends EventDispatcher implements EventDispatcherInterface
+{
+    /**
+     * @var EventDispatcherInterface
+     */
+    protected $trueEventDispatcher;
+
+    /**
+     * @var AsyncListener
+     */
+    protected $asyncListener;
+
+    /**
+     * @param EventDispatcherInterface $trueEventDispatcher
+     * @param AsyncListener            $asyncListener
+     */
+    public function __construct(EventDispatcherInterface $trueEventDispatcher, AsyncListener $asyncListener)
+    {
+        $this->trueEventDispatcher = $trueEventDispatcher;
+        $this->asyncListener = $asyncListener;
+    }
+
+    /**
+     * This method dispatches only those listeners that were marked as async.
+     *
+     * @param string                   $eventName
+     * @param ContractEvent|Event|null $event
+     */
+    public function dispatchAsyncListenersOnly($eventName, $event = null)
+    {
+        try {
+            $this->asyncListener->syncMode($eventName);
+
+            $this->parentDispatch($event, $eventName);
+        } finally {
+            $this->asyncListener->resetSyncMode();
+        }
+    }
+
+    abstract protected function parentDispatch($event, $eventName);
+}
diff --git a/AbstractAsyncListener.php b/AbstractAsyncListener.php
new file mode 100644
index 0000000..fbf8e19
--- /dev/null
+++ b/AbstractAsyncListener.php
@@ -0,0 +1,65 @@
+<?php
+
+namespace Enqueue\AsyncEventDispatcher;
+
+use Interop\Queue\Context;
+use Interop\Queue\Queue;
+use Symfony\Component\EventDispatcher\Event;
+
+abstract class AbstractAsyncListener
+{
+    /**
+     * @var Context
+     */
+    protected $context;
+
+    /**
+     * @var Registry
+     */
+    protected $registry;
+
+    /**
+     * @var Queue
+     */
+    protected $eventQueue;
+
+    /**
+     * @var bool
+     */
+    protected $syncMode;
+
+    /**
+     * @param Context      $context
+     * @param Registry     $registry
+     * @param Queue|string $eventQueue
+     */
+    public function __construct(Context $context, Registry $registry, $eventQueue)
+    {
+        $this->context = $context;
+        $this->registry = $registry;
+        $this->eventQueue = $eventQueue instanceof Queue ? $eventQueue : $context->createQueue($eventQueue);
+    }
+
+    public function resetSyncMode()
+    {
+        $this->syncMode = [];
+    }
+
+    /**
+     * @param string $eventName
+     */
+    public function syncMode($eventName)
+    {
+        $this->syncMode[$eventName] = true;
+    }
+
+    /**
+     * @param string $eventName
+     *
+     * @return bool
+     */
+    public function isSyncMode($eventName)
+    {
+        return isset($this->syncMode[$eventName]);
+    }
+}
diff --git a/AbstractPhpSerializerEventTransformer.php b/AbstractPhpSerializerEventTransformer.php
new file mode 100644
index 0000000..d713e01
--- /dev/null
+++ b/AbstractPhpSerializerEventTransformer.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Enqueue\AsyncEventDispatcher;
+
+use Interop\Queue\Context;
+use Interop\Queue\Message;
+use Symfony\Component\EventDispatcher\Event;
+use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
+use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
+
+abstract class AbstractPhpSerializerEventTransformer
+{
+    /**
+     * @var Context
+     */
+    protected $context;
+
+    /**
+     * @param Context $context
+     */
+    public function __construct(Context $context)
+    {
+        $this->context = $context;
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function toEvent($eventName, Message $message)
+    {
+        return unserialize($message->getBody());
+    }
+}
diff --git a/AsyncEventDispatcher.php b/AsyncEventDispatcher.php
index c74d974..44ecd1d 100644
--- a/AsyncEventDispatcher.php
+++ b/AsyncEventDispatcher.php
@@ -3,55 +3,69 @@
 namespace Enqueue\AsyncEventDispatcher;
 
 use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\EventDispatcher\EventDispatcher;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
+use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
 
-class AsyncEventDispatcher extends EventDispatcher
-{
+if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
     /**
-     * @var EventDispatcherInterface
+     * Symfony < 4.3
      */
-    private $trueEventDispatcher;
+    class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
+    {
+        /**
+         * {@inheritdoc}
+         */
+        public function dispatch($eventName, Event $event = null)
+        {
+            $this->parentDispatch($event, $eventName);
 
-    /**
-     * @var AsyncListener
-     */
-    private $asyncListener;
+            $this->trueEventDispatcher->dispatch($eventName, $event);
+        }
 
-    /**
-     * @param EventDispatcherInterface $trueEventDispatcher
-     * @param AsyncListener            $asyncListener
-     */
-    public function __construct(EventDispatcherInterface $trueEventDispatcher, AsyncListener $asyncListener)
-    {
-        $this->trueEventDispatcher = $trueEventDispatcher;
-        $this->asyncListener = $asyncListener;
+        protected function parentDispatch($event, $eventName)
+        {
+            parent::dispatch($eventName, $event);
+        }
     }
-
+} elseif (class_exists(Event::class)) {
     /**
-     * This method dispatches only those listeners that were marked as async.
-     *
-     * @param string     $eventName
-     * @param Event|null $event
+     * Symfony >= 4.3 and < 5.0
      */
-    public function dispatchAsyncListenersOnly($eventName, Event $event = null)
+    class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
     {
-        try {
-            $this->asyncListener->syncMode($eventName);
+        /**
+         * {@inheritdoc}
+         */
+        public function dispatch($event, $eventName = null)
+        {
+            $this->parentDispatch($event, $eventName);
 
-            parent::dispatch($eventName, $event);
-        } finally {
-            $this->asyncListener->resetSyncMode();
+            return $this->trueEventDispatcher->dispatch($event, $eventName);
         }
-    }
 
+        protected function parentDispatch($event, $eventName)
+        {
+            parent::dispatch($event, $eventName);
+        }
+    }
+} else {
     /**
-     * {@inheritdoc}
+     * Symfony >= 5.0
      */
-    public function dispatch($eventName, Event $event = null)
+    class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
     {
-        parent::dispatch($eventName, $event);
+        /**
+         * {@inheritdoc}
+         */
+        public function dispatch(object $event, string $eventName = null): object
+        {
+            $this->parentDispatch($event, $eventName);
+
+            return $this->trueEventDispatcher->dispatch($event, $eventName);
+        }
 
-        $this->trueEventDispatcher->dispatch($eventName, $event);
+        protected function parentDispatch($event, $eventName)
+        {
+            return parent::dispatch($event, $eventName);
+        }
     }
 }
diff --git a/AsyncListener.php b/AsyncListener.php
index 54f4cf2..e3ea3be 100644
--- a/AsyncListener.php
+++ b/AsyncListener.php
@@ -2,86 +2,96 @@
 
 namespace Enqueue\AsyncEventDispatcher;
 
-use Interop\Queue\Context;
-use Interop\Queue\Queue;
 use Symfony\Component\EventDispatcher\Event;
+use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
+use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
 
-class AsyncListener
-{
+if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
     /**
-     * @var Context
+     * Symfony < 4.3
      */
-    private $context;
-
-    /**
-     * @var Registry
-     */
-    private $registry;
+    class AsyncListener extends AbstractAsyncListener
+    {
+        public function __invoke(Event $event, $eventName)
+        {
+            $this->onEvent($event, $eventName);
+        }
 
-    /**
-     * @var Queue
-     */
-    private $eventQueue;
+        /**
+         * @param Event  $event
+         * @param string $eventName
+         */
+        public function onEvent(Event $event, $eventName)
+        {
+            if (false == isset($this->syncMode[$eventName])) {
+                $transformerName = $this->registry->getTransformerNameForEvent($eventName);
 
-    /**
-     * @var bool
-     */
-    private $syncMode;
+                $message = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event);
+                $message->setProperty('event_name', $eventName);
+                $message->setProperty('transformer_name', $transformerName);
 
+                $this->context->createProducer()->send($this->eventQueue, $message);
+            }
+        }
+    }
+} elseif (class_exists(Event::class)) {
     /**
-     * @param Context      $context
-     * @param Registry     $registry
-     * @param Queue|string $eventQueue
+     * Symfony >= 4.3 and < 5.0
      */
-    public function __construct(Context $context, Registry $registry, $eventQueue)
+    class AsyncListener extends AbstractAsyncListener
     {
-        $this->context = $context;
-        $this->registry = $registry;
-        $this->eventQueue = $eventQueue instanceof Queue ? $eventQueue : $context->createQueue($eventQueue);
-    }
+        /**
+         * @param Event|ContractEvent $event
+         * @param string              $eventName
+         */
+        public function __invoke($event, $eventName)
+        {
+            $this->onEvent($event, $eventName);
+        }
 
-    public function __invoke(Event $event, $eventName)
-    {
-        $this->onEvent($event, $eventName);
-    }
+        /**
+         * @param Event|ContractEvent $event
+         * @param string              $eventName
+         */
+        public function onEvent($event, $eventName)
+        {
+            if (false == isset($this->syncMode[$eventName])) {
+                $transformerName = $this->registry->getTransformerNameForEvent($eventName);
 
-    public function resetSyncMode()
-    {
-        $this->syncMode = [];
-    }
+                $message = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event);
+                $message->setProperty('event_name', $eventName);
+                $message->setProperty('transformer_name', $transformerName);
 
-    /**
-     * @param string $eventName
-     */
-    public function syncMode($eventName)
-    {
-        $this->syncMode[$eventName] = true;
+                $this->context->createProducer()->send($this->eventQueue, $message);
+            }
+        }
     }
-
+} else {
     /**
-     * @param string $eventName
-     *
-     * @return bool
+     * Symfony >= 5.0
      */
-    public function isSyncMode($eventName)
+    class AsyncListener extends AbstractAsyncListener
     {
-        return isset($this->syncMode[$eventName]);
-    }
+        public function __invoke(ContractEvent $event, $eventName)
+        {
+            $this->onEvent($event, $eventName);
+        }
 
-    /**
-     * @param Event  $event
-     * @param string $eventName
-     */
-    public function onEvent(Event $event, $eventName)
-    {
-        if (false == isset($this->syncMode[$eventName])) {
-            $transformerName = $this->registry->getTransformerNameForEvent($eventName);
+        /**
+         * @param Event  $event
+         * @param string $eventName
+         */
+        public function onEvent(ContractEvent $event, $eventName)
+        {
+            if (false == isset($this->syncMode[$eventName])) {
+                $transformerName = $this->registry->getTransformerNameForEvent($eventName);
 
-            $message = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event);
-            $message->setProperty('event_name', $eventName);
-            $message->setProperty('transformer_name', $transformerName);
+                $message = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event);
+                $message->setProperty('event_name', $eventName);
+                $message->setProperty('transformer_name', $transformerName);
 
-            $this->context->createProducer()->send($this->eventQueue, $message);
+                $this->context->createProducer()->send($this->eventQueue, $message);
+            }
         }
     }
 }
diff --git a/EventTransformer.php b/EventTransformer.php
index abb6756..5781f50 100644
--- a/EventTransformer.php
+++ b/EventTransformer.php
@@ -4,26 +4,88 @@
 
 use Interop\Queue\Message;
 use Symfony\Component\EventDispatcher\Event;
+use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
+use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
 
-interface EventTransformer
-{
+if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
     /**
-     * @param string     $eventName
-     * @param Event|null $event
-     *
-     * @return Message
+     * Symfony < 4.3
      */
-    public function toMessage($eventName, Event $event = null);
+    interface EventTransformer
+    {
+        /**
+         * @param string     $eventName
+         * @param Event|null $event
+         *
+         * @return Message
+         */
+        public function toMessage($eventName, Event $event = null);
 
+        /**
+         * If you able to transform message back to event return it.
+         * If you failed to transform for some reason you can return a string status (@param string $eventName
+         *
+         * @param Message $message
+         *
+         * @return Event|string|object
+         * @see Process constants) or an object that implements __toString method.
+         *      The object must have a __toString method is supposed to be used as Processor::process return value.
+         *
+         */
+        public function toEvent($eventName, Message $message);
+    }
+} elseif (class_exists(Event::class)) {
     /**
-     * If you able to transform message back to event return it.
-     * If you failed to transform for some reason you can return a string status (@see Process constants) or an object that implements __toString method.
-     * The object must have a __toString method is supposed to be used as Processor::process return value.
-     *
-     * @param string  $eventName
-     * @param Message $message
-     *
-     * @return Event|string|object
+     * Symfony >= 4.3 and < 5.0
      */
-    public function toEvent($eventName, Message $message);
+    interface EventTransformer
+    {
+        /**
+         * @param string                   $eventName
+         * @param ContractEvent|Event|null $event
+         *
+         * @return Message
+         */
+        public function toMessage($eventName, $event = null);
+
+        /**
+         * If you able to transform message back to event return it.
+         * If you failed to transform for some reason you can return a string status (@param string $eventName
+         *
+         * @param Message $message
+         *
+         * @return ContractEvent|Event|string|object
+         * @see Process constants) or an object that implements __toString method.
+         *      The object must have a __toString method is supposed to be used as Processor::process return value.
+         *
+         */
+        public function toEvent($eventName, Message $message);
+    }
+} else {
+    /**
+     * Symfony >= 5.0
+     */
+    interface EventTransformer
+    {
+        /**
+         * @param string             $eventName
+         * @param ContractEvent|null $event
+         *
+         * @return Message
+         */
+        public function toMessage($eventName, ContractEvent $event = null);
+
+        /**
+         * If you able to transform message back to event return it.
+         * If you failed to transform for some reason you can return a string status (@param string $eventName
+         *
+         * @param Message $message
+         *
+         * @return ContractEvent|string|object
+         * @see Process constants) or an object that implements __toString method.
+         *      The object must have a __toString method is supposed to be used as Processor::process return value.
+         *
+         */
+        public function toEvent($eventName, Message $message);
+    }
 }
diff --git a/PhpSerializerEventTransformer.php b/PhpSerializerEventTransformer.php
index 34392c4..c6bd4b6 100644
--- a/PhpSerializerEventTransformer.php
+++ b/PhpSerializerEventTransformer.php
@@ -2,38 +2,50 @@
 
 namespace Enqueue\AsyncEventDispatcher;
 
-use Interop\Queue\Context;
-use Interop\Queue\Message;
 use Symfony\Component\EventDispatcher\Event;
+use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
+use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
 
-class PhpSerializerEventTransformer implements EventTransformer
-{
+if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
     /**
-     * @var Context
+     * Symfony < 4.3
      */
-    private $context;
-
-    /**
-     * @param Context $context
-     */
-    public function __construct(Context $context)
+    class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
     {
-        $this->context = $context;
+        /**
+         * {@inheritdoc}
+         */
+        public function toMessage($eventName, Event $event = null)
+        {
+            return $this->context->createMessage(serialize($event));
+        }
     }
-
+} elseif (class_exists(Event::class)) {
     /**
-     * {@inheritdoc}
+     * Symfony >= 4.3 and < 5.0
      */
-    public function toMessage($eventName, Event $event = null)
+    class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
     {
-        return $this->context->createMessage(serialize($event));
+        /**
+         * {@inheritdoc}
+         */
+        public function toMessage($eventName, $event = null)
+        {
+            return $this->context->createMessage(serialize($event));
+        }
     }
-
+} else {
     /**
-     * {@inheritdoc}
+     * Symfony >= 5.0
      */
-    public function toEvent($eventName, Message $message)
+    class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
     {
-        return unserialize($message->getBody());
+        /**
+         * {@inheritdoc}
+         */
+        public function toMessage($eventName, ContractEvent $event = null)
+        {
+            return $this->context->createMessage(serialize($event));
+        }
     }
 }
diff --git a/Tests/AsyncListenerTest.php b/Tests/AsyncListenerTest.php
index 6e019f6..c5a1c35 100644
--- a/Tests/AsyncListenerTest.php
+++ b/Tests/AsyncListenerTest.php
@@ -10,9 +10,12 @@
 use Enqueue\Test\ClassExtensionTrait;
 use Interop\Queue\Context;
 use Interop\Queue\Producer;
+use PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\EventDispatcher\Event;
 use Symfony\Component\EventDispatcher\GenericEvent;
+use Symfony\Component\HttpKernel\Kernel;
+use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
 
 class AsyncListenerTest extends TestCase
 {
@@ -68,7 +71,9 @@ public function testShouldDoNothingIfSyncModeOn()
 
         $listener->syncMode('fooEvent');
 
-        $listener->onEvent(new Event(), 'fooEvent');
+        $eventClass = Kernel::VERSION_ID >= 50000 ? ContractEvent::class : Event::class;
+
+        $listener->onEvent(new $eventClass(), 'fooEvent');
         $listener->onEvent(new GenericEvent(), 'fooEvent');
     }
 
@@ -129,7 +134,7 @@ public function testShouldSendMessageIfSyncModeOff()
     }
 
     /**
-     * @return \PHPUnit_Framework_MockObject_MockObject|EventTransformer
+     * @return MockObject|EventTransformer
      */
     private function createEventTransformerMock()
     {
@@ -137,7 +142,7 @@ private function createEventTransformerMock()
     }
 
     /**
-     * @return \PHPUnit_Framework_MockObject_MockObject|Producer
+     * @return MockObject|Producer
      */
     private function createProducerMock()
     {
@@ -145,7 +150,7 @@ private function createProducerMock()
     }
 
     /**
-     * @return \PHPUnit_Framework_MockObject_MockObject|Context
+     * @return MockObject|Context
      */
     private function createContextMock()
     {
@@ -153,7 +158,7 @@ private function createContextMock()
     }
 
     /**
-     * @return \PHPUnit_Framework_MockObject_MockObject|Registry
+     * @return MockObject|Registry
      */
     private function createRegistryMock()
     {
diff --git a/Tests/AsyncProcessorTest.php b/Tests/AsyncProcessorTest.php
index 334022e..7237c9a 100644
--- a/Tests/AsyncProcessorTest.php
+++ b/Tests/AsyncProcessorTest.php
@@ -11,6 +11,7 @@
 use Enqueue\Null\NullMessage;
 use Enqueue\Test\ClassExtensionTrait;
 use Interop\Queue\Processor;
+use PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\EventDispatcher\GenericEvent;
 
@@ -97,7 +98,7 @@ public function testShouldDispatchAsyncListenersOnly()
     }
 
     /**
-     * @return \PHPUnit_Framework_MockObject_MockObject|EventTransformer
+     * @return MockObject|EventTransformer
      */
     private function createEventTransformerMock()
     {
@@ -105,7 +106,7 @@ private function createEventTransformerMock()
     }
 
     /**
-     * @return \PHPUnit_Framework_MockObject_MockObject|AsyncEventDispatcher
+     * @return MockObject|AsyncEventDispatcher
      */
     private function createProxyEventDispatcherMock()
     {
@@ -113,7 +114,7 @@ private function createProxyEventDispatcherMock()
     }
 
     /**
-     * @return \PHPUnit_Framework_MockObject_MockObject|Registry
+     * @return MockObject|Registry
      */
     private function createRegistryMock()
     {
diff --git a/Tests/Functional/UseCasesTest.php b/Tests/Functional/UseCasesTest.php
index e384885..41aebe5 100644
--- a/Tests/Functional/UseCasesTest.php
+++ b/Tests/Functional/UseCasesTest.php
@@ -12,6 +12,7 @@
 use Interop\Queue\Processor;
 use Interop\Queue\Queue;
 use PHPUnit\Framework\TestCase;
+use Symfony\Component\EventDispatcher\Event;
 use Symfony\Component\EventDispatcher\EventDispatcher;
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
 use Symfony\Component\EventDispatcher\GenericEvent;
@@ -103,7 +104,7 @@ public function testShouldDispatchBothAsyncEventAndSyncOne()
             echo "Async event\n";
         });
 
-        $this->dispatcher->dispatch('test_async', new GenericEvent());
+        $this->dispatch($this->dispatcher, new GenericEvent(),'test_async');
         $this->processMessages();
 
         $this->expectOutputString("Sync event\nSend message for event: test_async\nAsync event\n");
@@ -114,7 +115,7 @@ public function testShouldDispatchBothAsyncEventAndSyncOneFromWhenDispatchedFrom
         $this->dispatcher->addListener('foo', function ($event, $name, EventDispatcherInterface $dispatcher) {
             echo "Foo event\n";
 
-            $dispatcher->dispatch('test_async', new GenericEvent());
+            $this->dispatch($dispatcher, new GenericEvent(),'test_async');
         });
 
         $this->dispatcher->addListener('test_async', function () {
@@ -127,7 +128,8 @@ public function testShouldDispatchBothAsyncEventAndSyncOneFromWhenDispatchedFrom
             echo "Async event\n";
         });
 
-        $this->dispatcher->dispatch('foo');
+        $this->dispatch($this->dispatcher, new GenericEvent(),'foo');
+
         $this->processMessages();
 
         $this->expectOutputString("Foo event\nSync event\nSend message for event: test_async\nAsync event\n");
@@ -141,14 +143,14 @@ public function testShouldDispatchOtherAsyncEventFromAsyncEvent()
         $this->asyncDispatcher->addListener('test_async', function ($event, $eventName, EventDispatcherInterface $dispatcher) {
             echo "Async event\n";
 
-            $dispatcher->dispatch('test_async_from_async');
+            $this->dispatch($dispatcher, new GenericEvent(),'test_async_from_async');
         });
 
         $this->dispatcher->addListener('test_async_from_async', function ($event, $eventName, EventDispatcherInterface $dispatcher) {
             echo "Async event from event\n";
         });
 
-        $this->dispatcher->dispatch('test_async');
+        $this->dispatch($this->dispatcher, new GenericEvent(),'test_async');
 
         $this->processMessages();
         $this->processMessages();
@@ -167,16 +169,27 @@ public function testShouldDispatchSyncListenerIfDispatchedFromAsycListner()
         $this->asyncDispatcher->addListener('test_async', function ($event, $eventName, EventDispatcherInterface $dispatcher) {
             echo "Async event\n";
 
-            $dispatcher->dispatch('sync');
+            $this->dispatch($dispatcher, new GenericEvent(),'sync');
         });
 
-        $this->dispatcher->dispatch('test_async');
+        $this->dispatch($this->dispatcher, new GenericEvent(),'test_async');
 
         $this->processMessages();
 
         $this->expectOutputString("Send message for event: test_async\nAsync event\nSync event\n");
     }
 
+    private function dispatch(EventDispatcherInterface $dispatcher, $event, $eventName): void
+    {
+        if (!class_exists(Event::class)) {
+            // Symfony 5
+            $dispatcher->dispatch($event, $eventName);
+        } else {
+            // Symfony < 5
+            $dispatcher->dispatch($eventName, $event);
+        }
+    }
+
     private function processMessages()
     {
         $consumer = $this->context->createConsumer($this->queue);
diff --git a/Tests/PhpSerializerEventTransformerTest.php b/Tests/PhpSerializerEventTransformerTest.php
index 8e9ee81..49f3a93 100644
--- a/Tests/PhpSerializerEventTransformerTest.php
+++ b/Tests/PhpSerializerEventTransformerTest.php
@@ -8,6 +8,7 @@
 use Enqueue\Test\ClassExtensionTrait;
 use Interop\Queue\Context;
 use Interop\Queue\Message;
+use PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\EventDispatcher\GenericEvent;
 
@@ -52,7 +53,7 @@ public function testShouldReturnEventUnserializedFromMessageBodyOnToEvent()
     }
 
     /**
-     * @return \PHPUnit_Framework_MockObject_MockObject|Context
+     * @return MockObject|Context
      */
     private function createContextStub()
     {
diff --git a/Tests/ProxyEventDispatcherTest.php b/Tests/ProxyEventDispatcherTest.php
index 7c83191..905d55a 100644
--- a/Tests/ProxyEventDispatcherTest.php
+++ b/Tests/ProxyEventDispatcherTest.php
@@ -5,9 +5,12 @@
 use Enqueue\AsyncEventDispatcher\AsyncEventDispatcher;
 use Enqueue\AsyncEventDispatcher\AsyncListener;
 use Enqueue\Test\ClassExtensionTrait;
+use PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;
+use Symfony\Component\EventDispatcher\Event;
 use Symfony\Component\EventDispatcher\EventDispatcher;
 use Symfony\Component\EventDispatcher\GenericEvent;
+use Symfony\Component\HttpKernel\Kernel;
 
 class ProxyEventDispatcherTest extends TestCase
 {
@@ -80,7 +83,13 @@ public function testShouldCallOtherEventIfDispatchedFromAsyncEventOnDispatchAsyn
 
             $asyncEventWasCalled = true;
 
-            func_get_arg(2)->dispatch('theOtherEvent');
+            if (!class_exists(Event::class)) {
+                // Symfony 5
+                func_get_arg(2)->dispatch(func_get_arg(0), 'theOtherEvent');
+            } else {
+                // Symfony < 5
+                func_get_arg(2)->dispatch('theOtherEvent');
+            }
         });
 
         $event = new GenericEvent();
@@ -113,7 +122,7 @@ public function testShouldNotCallAsyncEventIfDispatchedFromOtherEventOnDispatchA
     }
 
     /**
-     * @return \PHPUnit_Framework_MockObject_MockObject|AsyncListener
+     * @return MockObject|AsyncListener
      */
     private function createAsyncListenerMock()
     {
diff --git a/composer.json b/composer.json
index 56c2208..ffc917b 100644
--- a/composer.json
+++ b/composer.json
@@ -12,11 +12,12 @@
         "symfony/event-dispatcher": "^3.4|^4|^5"
     },
     "require-dev": {
-        "phpunit/phpunit": "~5.5",
+        "phpunit/phpunit": "~7.5",
         "symfony/dependency-injection": "^3.4|^4|^5",
         "symfony/config": "^3.4|^4|^5",
         "symfony/http-kernel": "^3.4|^4|^5",
         "symfony/filesystem": "^3.4|^4|^5",
+        "symfony/yaml": "^3.4|^4|^5",
         "enqueue/null": "0.9.x-dev",
         "enqueue/fs": "0.9.x-dev",
         "enqueue/test": "0.9.x-dev"
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index e64c86d..b4c8fec 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -8,7 +8,6 @@
          convertWarningsToExceptions="true"
          processIsolation="false"
          stopOnFailure="false"
-         syntaxCheck="false"
          bootstrap="./vendor/autoload.php"
         >
 

From 23f28b9d885f9ec29e8b0232598e4d19c9a7ff17 Mon Sep 17 00:00:00 2001
From: Mathieu Lemoine <mathieu@doctoome.com>
Date: Thu, 12 Dec 2019 09:10:53 +0100
Subject: [PATCH 37/61] apply new cs-fixer and phpstan rules

---
 AbstractAsyncEventDispatcher.php          |  4 ---
 AbstractAsyncListener.php                 |  3 ---
 AbstractPhpSerializerEventTransformer.php |  9 -------
 AsyncEventDispatcher.php                  |  6 ++---
 AsyncListener.php                         |  8 +++---
 EventTransformer.php                      | 31 +++++++++++------------
 PhpSerializerEventTransformer.php         | 15 +++--------
 Tests/Functional/UseCasesTest.php         | 14 +++++-----
 Tests/ProxyEventDispatcherTest.php        |  1 -
 9 files changed, 31 insertions(+), 60 deletions(-)

diff --git a/AbstractAsyncEventDispatcher.php b/AbstractAsyncEventDispatcher.php
index c1feb02..5bc7d27 100644
--- a/AbstractAsyncEventDispatcher.php
+++ b/AbstractAsyncEventDispatcher.php
@@ -19,10 +19,6 @@ abstract class AbstractAsyncEventDispatcher extends EventDispatcher implements E
      */
     protected $asyncListener;
 
-    /**
-     * @param EventDispatcherInterface $trueEventDispatcher
-     * @param AsyncListener            $asyncListener
-     */
     public function __construct(EventDispatcherInterface $trueEventDispatcher, AsyncListener $asyncListener)
     {
         $this->trueEventDispatcher = $trueEventDispatcher;
diff --git a/AbstractAsyncListener.php b/AbstractAsyncListener.php
index fbf8e19..d4ac19a 100644
--- a/AbstractAsyncListener.php
+++ b/AbstractAsyncListener.php
@@ -4,7 +4,6 @@
 
 use Interop\Queue\Context;
 use Interop\Queue\Queue;
-use Symfony\Component\EventDispatcher\Event;
 
 abstract class AbstractAsyncListener
 {
@@ -29,8 +28,6 @@ abstract class AbstractAsyncListener
     protected $syncMode;
 
     /**
-     * @param Context      $context
-     * @param Registry     $registry
      * @param Queue|string $eventQueue
      */
     public function __construct(Context $context, Registry $registry, $eventQueue)
diff --git a/AbstractPhpSerializerEventTransformer.php b/AbstractPhpSerializerEventTransformer.php
index d713e01..6ac53cb 100644
--- a/AbstractPhpSerializerEventTransformer.php
+++ b/AbstractPhpSerializerEventTransformer.php
@@ -4,9 +4,6 @@
 
 use Interop\Queue\Context;
 use Interop\Queue\Message;
-use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
-use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
 
 abstract class AbstractPhpSerializerEventTransformer
 {
@@ -15,17 +12,11 @@ abstract class AbstractPhpSerializerEventTransformer
      */
     protected $context;
 
-    /**
-     * @param Context $context
-     */
     public function __construct(Context $context)
     {
         $this->context = $context;
     }
 
-    /**
-     * {@inheritdoc}
-     */
     public function toEvent($eventName, Message $message)
     {
         return unserialize($message->getBody());
diff --git a/AsyncEventDispatcher.php b/AsyncEventDispatcher.php
index 44ecd1d..1ea464c 100644
--- a/AsyncEventDispatcher.php
+++ b/AsyncEventDispatcher.php
@@ -7,7 +7,7 @@
 
 if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
     /**
-     * Symfony < 4.3
+     * Symfony < 4.3.
      */
     class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
     {
@@ -28,7 +28,7 @@ protected function parentDispatch($event, $eventName)
     }
 } elseif (class_exists(Event::class)) {
     /**
-     * Symfony >= 4.3 and < 5.0
+     * Symfony >= 4.3 and < 5.0.
      */
     class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
     {
@@ -49,7 +49,7 @@ protected function parentDispatch($event, $eventName)
     }
 } else {
     /**
-     * Symfony >= 5.0
+     * Symfony >= 5.0.
      */
     class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
     {
diff --git a/AsyncListener.php b/AsyncListener.php
index e3ea3be..bacf520 100644
--- a/AsyncListener.php
+++ b/AsyncListener.php
@@ -8,7 +8,7 @@
 
 if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
     /**
-     * Symfony < 4.3
+     * Symfony < 4.3.
      */
     class AsyncListener extends AbstractAsyncListener
     {
@@ -18,7 +18,6 @@ public function __invoke(Event $event, $eventName)
         }
 
         /**
-         * @param Event  $event
          * @param string $eventName
          */
         public function onEvent(Event $event, $eventName)
@@ -36,7 +35,7 @@ public function onEvent(Event $event, $eventName)
     }
 } elseif (class_exists(Event::class)) {
     /**
-     * Symfony >= 4.3 and < 5.0
+     * Symfony >= 4.3 and < 5.0.
      */
     class AsyncListener extends AbstractAsyncListener
     {
@@ -68,7 +67,7 @@ public function onEvent($event, $eventName)
     }
 } else {
     /**
-     * Symfony >= 5.0
+     * Symfony >= 5.0.
      */
     class AsyncListener extends AbstractAsyncListener
     {
@@ -78,7 +77,6 @@ public function __invoke(ContractEvent $event, $eventName)
         }
 
         /**
-         * @param Event  $event
          * @param string $eventName
          */
         public function onEvent(ContractEvent $event, $eventName)
diff --git a/EventTransformer.php b/EventTransformer.php
index 5781f50..f18f23b 100644
--- a/EventTransformer.php
+++ b/EventTransformer.php
@@ -9,13 +9,12 @@
 
 if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
     /**
-     * Symfony < 4.3
+     * Symfony < 4.3.
      */
     interface EventTransformer
     {
         /**
-         * @param string     $eventName
-         * @param Event|null $event
+         * @param string $eventName
          *
          * @return Message
          */
@@ -23,20 +22,20 @@ public function toMessage($eventName, Event $event = null);
 
         /**
          * If you able to transform message back to event return it.
-         * If you failed to transform for some reason you can return a string status (@param string $eventName
+         * If you failed to transform for some reason you can return a string status.
          *
-         * @param Message $message
+         * @param mixed $eventName
          *
          * @return Event|string|object
+         *
          * @see Process constants) or an object that implements __toString method.
          *      The object must have a __toString method is supposed to be used as Processor::process return value.
-         *
          */
         public function toEvent($eventName, Message $message);
     }
 } elseif (class_exists(Event::class)) {
     /**
-     * Symfony >= 4.3 and < 5.0
+     * Symfony >= 4.3 and < 5.0.
      */
     interface EventTransformer
     {
@@ -50,26 +49,25 @@ public function toMessage($eventName, $event = null);
 
         /**
          * If you able to transform message back to event return it.
-         * If you failed to transform for some reason you can return a string status (@param string $eventName
+         * If you failed to transform for some reason you can return a string status.
          *
-         * @param Message $message
+         * @param mixed $eventName
          *
          * @return ContractEvent|Event|string|object
+         *
          * @see Process constants) or an object that implements __toString method.
          *      The object must have a __toString method is supposed to be used as Processor::process return value.
-         *
          */
         public function toEvent($eventName, Message $message);
     }
 } else {
     /**
-     * Symfony >= 5.0
+     * Symfony >= 5.0.
      */
     interface EventTransformer
     {
         /**
-         * @param string             $eventName
-         * @param ContractEvent|null $event
+         * @param string $eventName
          *
          * @return Message
          */
@@ -77,14 +75,15 @@ public function toMessage($eventName, ContractEvent $event = null);
 
         /**
          * If you able to transform message back to event return it.
-         * If you failed to transform for some reason you can return a string status (@param string $eventName
+         * If you failed to transform for some reason you can return a string status.
          *
-         * @param Message $message
+         * @param mixed $eventNAme
+         * @param mixed $eventName
          *
          * @return ContractEvent|string|object
+         *
          * @see Process constants) or an object that implements __toString method.
          *      The object must have a __toString method is supposed to be used as Processor::process return value.
-         *
          */
         public function toEvent($eventName, Message $message);
     }
diff --git a/PhpSerializerEventTransformer.php b/PhpSerializerEventTransformer.php
index c6bd4b6..9348d4d 100644
--- a/PhpSerializerEventTransformer.php
+++ b/PhpSerializerEventTransformer.php
@@ -8,13 +8,10 @@
 
 if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
     /**
-     * Symfony < 4.3
+     * Symfony < 4.3.
      */
     class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
     {
-        /**
-         * {@inheritdoc}
-         */
         public function toMessage($eventName, Event $event = null)
         {
             return $this->context->createMessage(serialize($event));
@@ -22,13 +19,10 @@ public function toMessage($eventName, Event $event = null)
     }
 } elseif (class_exists(Event::class)) {
     /**
-     * Symfony >= 4.3 and < 5.0
+     * Symfony >= 4.3 and < 5.0.
      */
     class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
     {
-        /**
-         * {@inheritdoc}
-         */
         public function toMessage($eventName, $event = null)
         {
             return $this->context->createMessage(serialize($event));
@@ -36,13 +30,10 @@ public function toMessage($eventName, $event = null)
     }
 } else {
     /**
-     * Symfony >= 5.0
+     * Symfony >= 5.0.
      */
     class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
     {
-        /**
-         * {@inheritdoc}
-         */
         public function toMessage($eventName, ContractEvent $event = null)
         {
             return $this->context->createMessage(serialize($event));
diff --git a/Tests/Functional/UseCasesTest.php b/Tests/Functional/UseCasesTest.php
index 41aebe5..d05a9ad 100644
--- a/Tests/Functional/UseCasesTest.php
+++ b/Tests/Functional/UseCasesTest.php
@@ -104,7 +104,7 @@ public function testShouldDispatchBothAsyncEventAndSyncOne()
             echo "Async event\n";
         });
 
-        $this->dispatch($this->dispatcher, new GenericEvent(),'test_async');
+        $this->dispatch($this->dispatcher, new GenericEvent(), 'test_async');
         $this->processMessages();
 
         $this->expectOutputString("Sync event\nSend message for event: test_async\nAsync event\n");
@@ -115,7 +115,7 @@ public function testShouldDispatchBothAsyncEventAndSyncOneFromWhenDispatchedFrom
         $this->dispatcher->addListener('foo', function ($event, $name, EventDispatcherInterface $dispatcher) {
             echo "Foo event\n";
 
-            $this->dispatch($dispatcher, new GenericEvent(),'test_async');
+            $this->dispatch($dispatcher, new GenericEvent(), 'test_async');
         });
 
         $this->dispatcher->addListener('test_async', function () {
@@ -128,7 +128,7 @@ public function testShouldDispatchBothAsyncEventAndSyncOneFromWhenDispatchedFrom
             echo "Async event\n";
         });
 
-        $this->dispatch($this->dispatcher, new GenericEvent(),'foo');
+        $this->dispatch($this->dispatcher, new GenericEvent(), 'foo');
 
         $this->processMessages();
 
@@ -143,14 +143,14 @@ public function testShouldDispatchOtherAsyncEventFromAsyncEvent()
         $this->asyncDispatcher->addListener('test_async', function ($event, $eventName, EventDispatcherInterface $dispatcher) {
             echo "Async event\n";
 
-            $this->dispatch($dispatcher, new GenericEvent(),'test_async_from_async');
+            $this->dispatch($dispatcher, new GenericEvent(), 'test_async_from_async');
         });
 
         $this->dispatcher->addListener('test_async_from_async', function ($event, $eventName, EventDispatcherInterface $dispatcher) {
             echo "Async event from event\n";
         });
 
-        $this->dispatch($this->dispatcher, new GenericEvent(),'test_async');
+        $this->dispatch($this->dispatcher, new GenericEvent(), 'test_async');
 
         $this->processMessages();
         $this->processMessages();
@@ -169,10 +169,10 @@ public function testShouldDispatchSyncListenerIfDispatchedFromAsycListner()
         $this->asyncDispatcher->addListener('test_async', function ($event, $eventName, EventDispatcherInterface $dispatcher) {
             echo "Async event\n";
 
-            $this->dispatch($dispatcher, new GenericEvent(),'sync');
+            $this->dispatch($dispatcher, new GenericEvent(), 'sync');
         });
 
-        $this->dispatch($this->dispatcher, new GenericEvent(),'test_async');
+        $this->dispatch($this->dispatcher, new GenericEvent(), 'test_async');
 
         $this->processMessages();
 
diff --git a/Tests/ProxyEventDispatcherTest.php b/Tests/ProxyEventDispatcherTest.php
index 905d55a..eed680a 100644
--- a/Tests/ProxyEventDispatcherTest.php
+++ b/Tests/ProxyEventDispatcherTest.php
@@ -10,7 +10,6 @@
 use Symfony\Component\EventDispatcher\Event;
 use Symfony\Component\EventDispatcher\EventDispatcher;
 use Symfony\Component\EventDispatcher\GenericEvent;
-use Symfony\Component\HttpKernel\Kernel;
 
 class ProxyEventDispatcherTest extends TestCase
 {

From c3afdbc994548d28b8ffd7fab2a6ecec55271f9d Mon Sep 17 00:00:00 2001
From: Mathieu Lemoine <mathieu@doctoome.com>
Date: Thu, 12 Dec 2019 11:56:38 +0100
Subject: [PATCH 38/61] drop support for Symfony < 4.3

---
 AsyncEventDispatcher.php          | 26 ++-----------------------
 AsyncListener.php                 | 32 ++-----------------------------
 EventTransformer.php              | 31 ++----------------------------
 PhpSerializerEventTransformer.php | 16 ++--------------
 composer.json                     | 12 ++++++------
 5 files changed, 14 insertions(+), 103 deletions(-)

diff --git a/AsyncEventDispatcher.php b/AsyncEventDispatcher.php
index 1ea464c..153fdc1 100644
--- a/AsyncEventDispatcher.php
+++ b/AsyncEventDispatcher.php
@@ -3,32 +3,10 @@
 namespace Enqueue\AsyncEventDispatcher;
 
 use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
 
-if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
+if (class_exists(Event::class)) {
     /**
-     * Symfony < 4.3.
-     */
-    class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
-    {
-        /**
-         * {@inheritdoc}
-         */
-        public function dispatch($eventName, Event $event = null)
-        {
-            $this->parentDispatch($event, $eventName);
-
-            $this->trueEventDispatcher->dispatch($eventName, $event);
-        }
-
-        protected function parentDispatch($event, $eventName)
-        {
-            parent::dispatch($eventName, $event);
-        }
-    }
-} elseif (class_exists(Event::class)) {
-    /**
-     * Symfony >= 4.3 and < 5.0.
+     * Symfony < 5.0.
      */
     class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
     {
diff --git a/AsyncListener.php b/AsyncListener.php
index bacf520..ccbe5b0 100644
--- a/AsyncListener.php
+++ b/AsyncListener.php
@@ -3,39 +3,11 @@
 namespace Enqueue\AsyncEventDispatcher;
 
 use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
 use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
 
-if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
+if (class_exists(Event::class)) {
     /**
-     * Symfony < 4.3.
-     */
-    class AsyncListener extends AbstractAsyncListener
-    {
-        public function __invoke(Event $event, $eventName)
-        {
-            $this->onEvent($event, $eventName);
-        }
-
-        /**
-         * @param string $eventName
-         */
-        public function onEvent(Event $event, $eventName)
-        {
-            if (false == isset($this->syncMode[$eventName])) {
-                $transformerName = $this->registry->getTransformerNameForEvent($eventName);
-
-                $message = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event);
-                $message->setProperty('event_name', $eventName);
-                $message->setProperty('transformer_name', $transformerName);
-
-                $this->context->createProducer()->send($this->eventQueue, $message);
-            }
-        }
-    }
-} elseif (class_exists(Event::class)) {
-    /**
-     * Symfony >= 4.3 and < 5.0.
+     * Symfony < 5.0.
      */
     class AsyncListener extends AbstractAsyncListener
     {
diff --git a/EventTransformer.php b/EventTransformer.php
index f18f23b..352930c 100644
--- a/EventTransformer.php
+++ b/EventTransformer.php
@@ -4,38 +4,11 @@
 
 use Interop\Queue\Message;
 use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
 use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
 
-if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
+if (class_exists(Event::class)) {
     /**
-     * Symfony < 4.3.
-     */
-    interface EventTransformer
-    {
-        /**
-         * @param string $eventName
-         *
-         * @return Message
-         */
-        public function toMessage($eventName, Event $event = null);
-
-        /**
-         * If you able to transform message back to event return it.
-         * If you failed to transform for some reason you can return a string status.
-         *
-         * @param mixed $eventName
-         *
-         * @return Event|string|object
-         *
-         * @see Process constants) or an object that implements __toString method.
-         *      The object must have a __toString method is supposed to be used as Processor::process return value.
-         */
-        public function toEvent($eventName, Message $message);
-    }
-} elseif (class_exists(Event::class)) {
-    /**
-     * Symfony >= 4.3 and < 5.0.
+     * Symfony < 5.0.
      */
     interface EventTransformer
     {
diff --git a/PhpSerializerEventTransformer.php b/PhpSerializerEventTransformer.php
index 9348d4d..c6a3e2c 100644
--- a/PhpSerializerEventTransformer.php
+++ b/PhpSerializerEventTransformer.php
@@ -3,23 +3,11 @@
 namespace Enqueue\AsyncEventDispatcher;
 
 use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
 use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
 
-if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
+if (class_exists(Event::class)) {
     /**
-     * Symfony < 4.3.
-     */
-    class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
-    {
-        public function toMessage($eventName, Event $event = null)
-        {
-            return $this->context->createMessage(serialize($event));
-        }
-    }
-} elseif (class_exists(Event::class)) {
-    /**
-     * Symfony >= 4.3 and < 5.0.
+     * Symfony < 5.0.
      */
     class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
     {
diff --git a/composer.json b/composer.json
index ffc917b..efd3f99 100644
--- a/composer.json
+++ b/composer.json
@@ -9,15 +9,15 @@
         "php": "^7.1.3",
         "enqueue/enqueue": "^0.9",
         "queue-interop/queue-interop": "^0.7|^0.8",
-        "symfony/event-dispatcher": "^3.4|^4|^5"
+        "symfony/event-dispatcher": "^4.3|^5"
     },
     "require-dev": {
         "phpunit/phpunit": "~7.5",
-        "symfony/dependency-injection": "^3.4|^4|^5",
-        "symfony/config": "^3.4|^4|^5",
-        "symfony/http-kernel": "^3.4|^4|^5",
-        "symfony/filesystem": "^3.4|^4|^5",
-        "symfony/yaml": "^3.4|^4|^5",
+        "symfony/dependency-injection": "^4.3|^5",
+        "symfony/config": "^4.3|^5",
+        "symfony/http-kernel": "^4.3|^5",
+        "symfony/filesystem": "^4.3|^5",
+        "symfony/yaml": "^4.3|^5",
         "enqueue/null": "0.9.x-dev",
         "enqueue/fs": "0.9.x-dev",
         "enqueue/test": "0.9.x-dev"

From f2084d31d5201fe478a9eaba1c81bcf8fac22397 Mon Sep 17 00:00:00 2001
From: Maksim Kotlyar <kotlyar.maksim@gmail.com>
Date: Thu, 19 Dec 2019 09:01:09 +0200
Subject: [PATCH 39/61] master is 0.10

---
 composer.json | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/composer.json b/composer.json
index efd3f99..dae5bb5 100644
--- a/composer.json
+++ b/composer.json
@@ -7,8 +7,8 @@
     "license": "MIT",
     "require": {
         "php": "^7.1.3",
-        "enqueue/enqueue": "^0.9",
-        "queue-interop/queue-interop": "^0.7|^0.8",
+        "enqueue/enqueue": "^0.10",
+        "queue-interop/queue-interop": "^0.8",
         "symfony/event-dispatcher": "^4.3|^5"
     },
     "require-dev": {
@@ -18,9 +18,9 @@
         "symfony/http-kernel": "^4.3|^5",
         "symfony/filesystem": "^4.3|^5",
         "symfony/yaml": "^4.3|^5",
-        "enqueue/null": "0.9.x-dev",
-        "enqueue/fs": "0.9.x-dev",
-        "enqueue/test": "0.9.x-dev"
+        "enqueue/null": "0.10.x-dev",
+        "enqueue/fs": "0.10.x-dev",
+        "enqueue/test": "0.10.x-dev"
     },
     "support": {
         "email": "opensource@forma-pro.com",
@@ -40,7 +40,7 @@
     },
     "extra": {
         "branch-alias": {
-            "dev-master": "0.9.x-dev"
+            "dev-master": "0.10.x-dev"
         }
     }
 }

From 31ebfcc4fcbe80aa1bec228c3eaf1c45dc85c5ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pawe=C5=82=20Niedzielski?=
 <pawel.tadeusz.niedzielski@gmail.com>
Date: Mon, 27 Jan 2020 00:45:10 +0100
Subject: [PATCH 40/61] Add schema declaration to phpunit files. Remove
 parameters set to phpunit defaults.

---
 phpunit.xml.dist | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index b4c8fec..e5c3f6d 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,15 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<phpunit backupGlobals="false"
-         backupStaticAttributes="false"
-         colors="true"
-         convertErrorsToExceptions="true"
-         convertNoticesToExceptions="true"
-         convertWarningsToExceptions="true"
-         processIsolation="false"
-         stopOnFailure="false"
-         bootstrap="./vendor/autoload.php"
-        >
+<phpunit
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.5/phpunit.xsd"
+    colors="true"
+    bootstrap="./vendor/autoload.php"
+>
 
     <testsuites>
         <testsuite name="Symfony Async Event Dispatcher Test Suite">

From 08d4b41ea8a75c8a345ac2919e634d47d41b9d01 Mon Sep 17 00:00:00 2001
From: Witold Wasiczko <witold@wasiczko.pl>
Date: Thu, 30 Jul 2020 20:38:01 +0200
Subject: [PATCH 41/61] Add php 7.3 and 7.4 travis env to test

---
 .travis.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 9ed4fa1..ae8b10d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,8 @@ language: php
 php:
     - '7.1'
     - '7.2'
+    - '7.3'
+    - '7.4'
 
 cache:
     directories:

From 08d6bde105d68d80f33557acb99896e48d680416 Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Fri, 22 Jan 2021 15:12:15 +0200
Subject: [PATCH 42/61] Fix more setUp signatures

---
 Tests/Functional/UseCasesTest.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Tests/Functional/UseCasesTest.php b/Tests/Functional/UseCasesTest.php
index d05a9ad..f073ff5 100644
--- a/Tests/Functional/UseCasesTest.php
+++ b/Tests/Functional/UseCasesTest.php
@@ -53,7 +53,7 @@ class UseCasesTest extends TestCase
      */
     protected $asyncProcessor;
 
-    public function setUp()
+    public function setUp(): void
     {
         (new Filesystem())->remove(__DIR__.'/queues/');
 

From e61da4995706f1904514f3e74abd00dd9f458464 Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Sun, 24 Jan 2021 20:45:22 +0200
Subject: [PATCH 43/61] Fix more attributes; nullable params

---
 Tests/AsyncListenerTest.php          | 2 ++
 Tests/ContainerAwareRegistryTest.php | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/Tests/AsyncListenerTest.php b/Tests/AsyncListenerTest.php
index c5a1c35..f006352 100644
--- a/Tests/AsyncListenerTest.php
+++ b/Tests/AsyncListenerTest.php
@@ -8,6 +8,7 @@
 use Enqueue\Null\NullMessage;
 use Enqueue\Null\NullQueue;
 use Enqueue\Test\ClassExtensionTrait;
+use Enqueue\Test\ReadAttributeTrait;
 use Interop\Queue\Context;
 use Interop\Queue\Producer;
 use PHPUnit\Framework\MockObject\MockObject;
@@ -20,6 +21,7 @@
 class AsyncListenerTest extends TestCase
 {
     use ClassExtensionTrait;
+    use ReadAttributeTrait;
 
     public function testCouldBeConstructedWithContextAndRegistryAndEventQueueAsString()
     {
diff --git a/Tests/ContainerAwareRegistryTest.php b/Tests/ContainerAwareRegistryTest.php
index 1255502..3be3b5f 100644
--- a/Tests/ContainerAwareRegistryTest.php
+++ b/Tests/ContainerAwareRegistryTest.php
@@ -6,12 +6,14 @@
 use Enqueue\AsyncEventDispatcher\EventTransformer;
 use Enqueue\AsyncEventDispatcher\Registry;
 use Enqueue\Test\ClassExtensionTrait;
+use Enqueue\Test\ReadAttributeTrait;
 use PHPUnit\Framework\TestCase;
 use Symfony\Component\DependencyInjection\Container;
 
 class ContainerAwareRegistryTest extends TestCase
 {
     use ClassExtensionTrait;
+    use ReadAttributeTrait;
 
     public function testShouldImplementRegistryInterface()
     {

From 88f274e46df7dc0b7437871c027c7e93efc66f6e Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Mon, 25 Jan 2021 09:46:24 +0200
Subject: [PATCH 44/61] Fix CS

---
 Tests/Functional/UseCasesTest.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Tests/Functional/UseCasesTest.php b/Tests/Functional/UseCasesTest.php
index f073ff5..169d8ea 100644
--- a/Tests/Functional/UseCasesTest.php
+++ b/Tests/Functional/UseCasesTest.php
@@ -53,7 +53,7 @@ class UseCasesTest extends TestCase
      */
     protected $asyncProcessor;
 
-    public function setUp(): void
+    protected function setUp(): void
     {
         (new Filesystem())->remove(__DIR__.'/queues/');
 

From 124a979cc6d7e08df08efaf7fd26adfb6aa573f7 Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Mon, 25 Jan 2021 09:51:30 +0200
Subject: [PATCH 45/61] Update PHP and PHPUnit across all packages; fix
 ext-rdkafka requirement

---
 composer.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/composer.json b/composer.json
index dae5bb5..d4a7212 100644
--- a/composer.json
+++ b/composer.json
@@ -6,13 +6,13 @@
     "homepage": "https://enqueue.forma-pro.com/",
     "license": "MIT",
     "require": {
-        "php": "^7.1.3",
+        "php": "^7.3",
         "enqueue/enqueue": "^0.10",
         "queue-interop/queue-interop": "^0.8",
         "symfony/event-dispatcher": "^4.3|^5"
     },
     "require-dev": {
-        "phpunit/phpunit": "~7.5",
+        "phpunit/phpunit": "^9.5",
         "symfony/dependency-injection": "^4.3|^5",
         "symfony/config": "^4.3|^5",
         "symfony/http-kernel": "^4.3|^5",

From 798ddcb15bf5306f89e64762634d20c586c77e77 Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Tue, 9 Feb 2021 02:14:42 +0200
Subject: [PATCH 46/61] Fix package CI

- Add push to master trigger;
- Replace the clunky cache + composer install steps with an Action;
- Replace Travis with GH WF in packages;
- Add the missing CI to amqp-tools;
- Replace the shields.
---
 .github/workflows/ci.yml | 29 +++++++++++++++++++++++++++++
 .travis.yml              | 23 -----------------------
 README.md                |  2 +-
 3 files changed, 30 insertions(+), 24 deletions(-)
 create mode 100644 .github/workflows/ci.yml
 delete mode 100644 .travis.yml

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..e60e63b
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,29 @@
+name: CI
+on:
+  pull_request:
+  push:
+    branches:
+      - master
+jobs:
+  tests:
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        php: ['7.3', '7.4']
+
+    name: PHP ${{ matrix.php }} tests
+
+    steps:
+      - uses: actions/checkout@v2
+
+      - uses: shivammathur/setup-php@v2
+        with:
+          php-version: ${{ matrix.php }}
+          coverage: none
+
+      - uses: "ramsey/composer-install@v1"
+        with:
+          composer-options: "--prefer-source"
+
+      - run: vendor/bin/phpunit --exclude-group=functional
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index ae8b10d..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-sudo: false
-
-git:
-    depth: 10
-
-language: php
-
-php:
-    - '7.1'
-    - '7.2'
-    - '7.3'
-    - '7.4'
-
-cache:
-    directories:
-        - $HOME/.composer/cache
-
-install:
-    - composer self-update
-    - composer install --prefer-source
-
-script:
-    - vendor/bin/phpunit --exclude-group=functional
diff --git a/README.md b/README.md
index 93cee30..1ba408f 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
 # Symfony Async Event Dispatcher.
 
 [![Gitter](https://badges.gitter.im/php-enqueue/Lobby.svg)](https://gitter.im/php-enqueue/Lobby)
-[![Build Status](https://travis-ci.org/php-enqueue/async-event-dispathcer.png?branch=master)](https://travis-ci.org/php-enqueue/async-event-dispathcer)
+[![Build Status](https://img.shields.io/github/workflow/status/php-enqueue/async-event-dispathcer/CI)](https://github.com/php-enqueue/async-event-dispathcer/actions?query=workflow%3ACI)
 [![Total Downloads](https://poser.pugx.org/enqueue/async-event-dispathcer/d/total.png)](https://packagist.org/packages/enqueue/async-event-dispathcer)
 [![Latest Stable Version](https://poser.pugx.org/enqueue/async-event-dispathcer/version.png)](https://packagist.org/packages/enqueue/async-event-dispathcer)
 

From 8d67c80cc669b10b1faa52eee98728597c416d21 Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Mon, 25 Jan 2021 10:26:59 +0200
Subject: [PATCH 47/61] Allow php8 in all composer.json files

---
 composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index d4a7212..d5adc5f 100644
--- a/composer.json
+++ b/composer.json
@@ -6,7 +6,7 @@
     "homepage": "https://enqueue.forma-pro.com/",
     "license": "MIT",
     "require": {
-        "php": "^7.3",
+        "php": "^7.3|^8.0",
         "enqueue/enqueue": "^0.10",
         "queue-interop/queue-interop": "^0.8",
         "symfony/event-dispatcher": "^4.3|^5"

From c1d6c606d8523c7d9acd9bf401aed69b54ad4d6f Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Tue, 9 Feb 2021 14:01:28 +0200
Subject: [PATCH 48/61] Add php 8 to packages' build matrices; normalize
 composer reqs

---
 .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 e60e63b..a168dca 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,7 +10,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        php: ['7.3', '7.4']
+        php: ['7.3', '7.4', '8.0']
 
     name: PHP ${{ matrix.php }} tests
 

From 7843bc6e35067b9e738ce9395cee3f54e7d41091 Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Thu, 10 Feb 2022 18:49:44 +0200
Subject: [PATCH 49/61] Add support for Symfony 6

---
 composer.json | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/composer.json b/composer.json
index d5adc5f..28ed42b 100644
--- a/composer.json
+++ b/composer.json
@@ -9,15 +9,15 @@
         "php": "^7.3|^8.0",
         "enqueue/enqueue": "^0.10",
         "queue-interop/queue-interop": "^0.8",
-        "symfony/event-dispatcher": "^4.3|^5"
+        "symfony/event-dispatcher": "^4.3|^5|^6.0"
     },
     "require-dev": {
         "phpunit/phpunit": "^9.5",
-        "symfony/dependency-injection": "^4.3|^5",
-        "symfony/config": "^4.3|^5",
-        "symfony/http-kernel": "^4.3|^5",
-        "symfony/filesystem": "^4.3|^5",
-        "symfony/yaml": "^4.3|^5",
+        "symfony/dependency-injection": "^4.3|^5|^6.0",
+        "symfony/config": "^4.3|^5|^6.0",
+        "symfony/http-kernel": "^4.3|^5|^6.0",
+        "symfony/filesystem": "^4.3|^5|^6.0",
+        "symfony/yaml": "^4.3|^5|^6.0",
         "enqueue/null": "0.10.x-dev",
         "enqueue/fs": "0.10.x-dev",
         "enqueue/test": "0.10.x-dev"

From 44938e6655754181897b0e8249ddb2e56eb8b032 Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Tue, 15 Feb 2022 21:25:41 +0200
Subject: [PATCH 50/61] Clean up and typos

---
 README.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index 1ba408f..f1629b5 100644
--- a/README.md
+++ b/README.md
@@ -10,12 +10,12 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
 # Symfony Async Event Dispatcher.
 
 [![Gitter](https://badges.gitter.im/php-enqueue/Lobby.svg)](https://gitter.im/php-enqueue/Lobby)
-[![Build Status](https://img.shields.io/github/workflow/status/php-enqueue/async-event-dispathcer/CI)](https://github.com/php-enqueue/async-event-dispathcer/actions?query=workflow%3ACI)
-[![Total Downloads](https://poser.pugx.org/enqueue/async-event-dispathcer/d/total.png)](https://packagist.org/packages/enqueue/async-event-dispathcer)
-[![Latest Stable Version](https://poser.pugx.org/enqueue/async-event-dispathcer/version.png)](https://packagist.org/packages/enqueue/async-event-dispathcer)
+[![Build Status](https://img.shields.io/github/workflow/status/php-enqueue/async-event-dispatcher/CI)](https://github.com/php-enqueue/async-event-dispathcer/actions?query=workflow%3ACI)
+[![Total Downloads](https://poser.pugx.org/enqueue/async-event-dispathcer/d/total.png)](https://packagist.org/packages/enqueue/async-event-dispatcher)
+[![Latest Stable Version](https://poser.pugx.org/enqueue/async-event-dispathcer/version.png)](https://packagist.org/packages/enqueue/async-event-dispatcher)
 
 It contains an extension to Symfony's [EventDispatcher](https://symfony.com/doc/current/components/event_dispatcher.html) component.
-It allows to processes events in background by sending them to MQ.
+It allows to process events in background by sending them to MQ.
 
 ## Resources
 

From 652c071c9b15572a74cc055411785361cd63f3f8 Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Tue, 15 Feb 2022 21:47:24 +0200
Subject: [PATCH 51/61] Fix events compatibility

---
 DependencyInjection/AsyncEventsPass.php | 51 ++++++++++++++++++++-----
 1 file changed, 41 insertions(+), 10 deletions(-)

diff --git a/DependencyInjection/AsyncEventsPass.php b/DependencyInjection/AsyncEventsPass.php
index 5371eb8..e57d710 100644
--- a/DependencyInjection/AsyncEventsPass.php
+++ b/DependencyInjection/AsyncEventsPass.php
@@ -6,6 +6,7 @@
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
+use Symfony\Component\HttpKernel\Kernel;
 
 class AsyncEventsPass implements CompilerPassInterface
 {
@@ -21,6 +22,9 @@ public function process(ContainerBuilder $container): void
 
         $defaultClient = $container->getParameter('enqueue.default_client');
 
+        // TODO: Remove when dropping Symfony < 5.3
+        $useLegacyDispatcherConfig = (Kernel::VERSION_ID < 50300);
+
         $registeredToEvent = [];
         foreach ($container->findTaggedServiceIds('kernel.event_listener') as $serviceId => $tagAttributes) {
             foreach ($tagAttributes as $tagAttribute) {
@@ -32,8 +36,10 @@ public function process(ContainerBuilder $container): void
 
                 $service = $container->getDefinition($serviceId);
 
-                $service->clearTag('kernel.event_listener');
-                $service->addTag('enqueue.async_event_listener', $tagAttribute);
+                if ($useLegacyDispatcherConfig) {
+                    $service->clearTag('kernel.event_listener');
+                    $service->addTag('enqueue.async_event_listener', $tagAttribute);
+                }
 
                 if (false == isset($registeredToEvent[$event])) {
                     $container->getDefinition('enqueue.events.async_listener')
@@ -43,6 +49,16 @@ public function process(ContainerBuilder $container): void
                         ])
                     ;
 
+                    if (!$useLegacyDispatcherConfig) {
+                        $container->getDefinition('enqueue.events.async_listener')
+                            ->addTag('kernel.event_listener', [
+                                'event' => $event,
+                                'method' => 'onEvent',
+                                'dispatcher' => 'enqueue.events.event_dispatcher',
+                            ])
+                        ;
+                    }
+
                     $container->getDefinition('enqueue.events.async_processor')
                         ->addTag('enqueue.processor', [
                             'topic' => 'event.'.$event,
@@ -62,8 +78,11 @@ public function process(ContainerBuilder $container): void
                 }
 
                 $service = $container->getDefinition($serviceId);
-                $service->clearTag('kernel.event_subscriber');
-                $service->addTag('enqueue.async_event_subscriber', $tagAttribute);
+
+                if ($useLegacyDispatcherConfig) {
+                    $service->clearTag('kernel.event_subscriber');
+                    $service->addTag('enqueue.async_event_subscriber', $tagAttribute);
+                }
 
                 /** @var EventSubscriberInterface $serviceClass */
                 $serviceClass = $service->getClass();
@@ -77,6 +96,16 @@ public function process(ContainerBuilder $container): void
                             ])
                         ;
 
+                        if (!$useLegacyDispatcherConfig) {
+                            $container->getDefinition('enqueue.events.async_listener')
+                                ->addTag('kernel.event_listener', [
+                                    'event' => $event,
+                                    'method' => 'onEvent',
+                                    'dispatcher' => 'enqueue.events.event_dispatcher',
+                                ])
+                            ;
+                        }
+
                         $container->getDefinition('enqueue.events.async_processor')
                             ->addTag('enqueue.processor', [
                                 'topicName' => 'event.'.$event,
@@ -90,11 +119,13 @@ public function process(ContainerBuilder $container): void
             }
         }
 
-        $registerListenersPass = new RegisterListenersPass(
-            'enqueue.events.event_dispatcher',
-            'enqueue.async_event_listener',
-            'enqueue.async_event_subscriber'
-        );
-        $registerListenersPass->process($container);
+        if ($useLegacyDispatcherConfig) {
+            $registerListenersPass = new RegisterListenersPass(
+                'enqueue.events.event_dispatcher',
+                'enqueue.async_event_listener',
+                'enqueue.async_event_subscriber'
+            );
+            $registerListenersPass->process($container);
+        }
     }
 }

From 3121816dfc129b7dd32ac3131540f91e1ff3c42b Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Wed, 16 Feb 2022 13:14:49 +0200
Subject: [PATCH 52/61] =?UTF-8?q?Drop=20Symfony=20<=205.1=20=F0=9F=94=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 AsyncEventDispatcher.php                | 47 +++--------------
 AsyncListener.php                       | 66 +++++------------------
 DependencyInjection/AsyncEventsPass.php | 56 +++++---------------
 EventTransformer.php                    | 69 +++++++------------------
 PhpSerializerEventTransformer.php       | 27 ++--------
 Tests/AsyncListenerTest.php             |  8 +--
 composer.json                           | 14 ++---
 7 files changed, 68 insertions(+), 219 deletions(-)

diff --git a/AsyncEventDispatcher.php b/AsyncEventDispatcher.php
index 153fdc1..fa7393e 100644
--- a/AsyncEventDispatcher.php
+++ b/AsyncEventDispatcher.php
@@ -2,48 +2,17 @@
 
 namespace Enqueue\AsyncEventDispatcher;
 
-use Symfony\Component\EventDispatcher\Event;
-
-if (class_exists(Event::class)) {
-    /**
-     * Symfony < 5.0.
-     */
-    class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
+class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
+{
+    public function dispatch(object $event, string $eventName = null): object
     {
-        /**
-         * {@inheritdoc}
-         */
-        public function dispatch($event, $eventName = null)
-        {
-            $this->parentDispatch($event, $eventName);
-
-            return $this->trueEventDispatcher->dispatch($event, $eventName);
-        }
+        $this->parentDispatch($event, $eventName);
 
-        protected function parentDispatch($event, $eventName)
-        {
-            parent::dispatch($event, $eventName);
-        }
+        return $this->trueEventDispatcher->dispatch($event, $eventName);
     }
-} else {
-    /**
-     * Symfony >= 5.0.
-     */
-    class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
-    {
-        /**
-         * {@inheritdoc}
-         */
-        public function dispatch(object $event, string $eventName = null): object
-        {
-            $this->parentDispatch($event, $eventName);
 
-            return $this->trueEventDispatcher->dispatch($event, $eventName);
-        }
-
-        protected function parentDispatch($event, $eventName)
-        {
-            return parent::dispatch($event, $eventName);
-        }
+    protected function parentDispatch($event, $eventName)
+    {
+        return parent::dispatch($event, $eventName);
     }
 }
diff --git a/AsyncListener.php b/AsyncListener.php
index ccbe5b0..2be4976 100644
--- a/AsyncListener.php
+++ b/AsyncListener.php
@@ -2,66 +2,28 @@
 
 namespace Enqueue\AsyncEventDispatcher;
 
-use Symfony\Component\EventDispatcher\Event;
-use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
+use Symfony\Contracts\EventDispatcher\Event;
 
-if (class_exists(Event::class)) {
-    /**
-     * Symfony < 5.0.
-     */
-    class AsyncListener extends AbstractAsyncListener
+class AsyncListener extends AbstractAsyncListener
+{
+    public function __invoke(Event $event, $eventName)
     {
-        /**
-         * @param Event|ContractEvent $event
-         * @param string              $eventName
-         */
-        public function __invoke($event, $eventName)
-        {
-            $this->onEvent($event, $eventName);
-        }
-
-        /**
-         * @param Event|ContractEvent $event
-         * @param string              $eventName
-         */
-        public function onEvent($event, $eventName)
-        {
-            if (false == isset($this->syncMode[$eventName])) {
-                $transformerName = $this->registry->getTransformerNameForEvent($eventName);
-
-                $message = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event);
-                $message->setProperty('event_name', $eventName);
-                $message->setProperty('transformer_name', $transformerName);
-
-                $this->context->createProducer()->send($this->eventQueue, $message);
-            }
-        }
+        $this->onEvent($event, $eventName);
     }
-} else {
+
     /**
-     * Symfony >= 5.0.
+     * @param string $eventName
      */
-    class AsyncListener extends AbstractAsyncListener
+    public function onEvent(Event $event, $eventName)
     {
-        public function __invoke(ContractEvent $event, $eventName)
-        {
-            $this->onEvent($event, $eventName);
-        }
-
-        /**
-         * @param string $eventName
-         */
-        public function onEvent(ContractEvent $event, $eventName)
-        {
-            if (false == isset($this->syncMode[$eventName])) {
-                $transformerName = $this->registry->getTransformerNameForEvent($eventName);
+        if (false == isset($this->syncMode[$eventName])) {
+            $transformerName = $this->registry->getTransformerNameForEvent($eventName);
 
-                $message = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event);
-                $message->setProperty('event_name', $eventName);
-                $message->setProperty('transformer_name', $transformerName);
+            $message = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event);
+            $message->setProperty('event_name', $eventName);
+            $message->setProperty('transformer_name', $transformerName);
 
-                $this->context->createProducer()->send($this->eventQueue, $message);
-            }
+            $this->context->createProducer()->send($this->eventQueue, $message);
         }
     }
 }
diff --git a/DependencyInjection/AsyncEventsPass.php b/DependencyInjection/AsyncEventsPass.php
index e57d710..5eecd09 100644
--- a/DependencyInjection/AsyncEventsPass.php
+++ b/DependencyInjection/AsyncEventsPass.php
@@ -22,9 +22,6 @@ public function process(ContainerBuilder $container): void
 
         $defaultClient = $container->getParameter('enqueue.default_client');
 
-        // TODO: Remove when dropping Symfony < 5.3
-        $useLegacyDispatcherConfig = (Kernel::VERSION_ID < 50300);
-
         $registeredToEvent = [];
         foreach ($container->findTaggedServiceIds('kernel.event_listener') as $serviceId => $tagAttributes) {
             foreach ($tagAttributes as $tagAttribute) {
@@ -34,13 +31,6 @@ public function process(ContainerBuilder $container): void
 
                 $event = $tagAttribute['event'];
 
-                $service = $container->getDefinition($serviceId);
-
-                if ($useLegacyDispatcherConfig) {
-                    $service->clearTag('kernel.event_listener');
-                    $service->addTag('enqueue.async_event_listener', $tagAttribute);
-                }
-
                 if (false == isset($registeredToEvent[$event])) {
                     $container->getDefinition('enqueue.events.async_listener')
                         ->addTag('kernel.event_listener', [
@@ -49,15 +39,13 @@ public function process(ContainerBuilder $container): void
                         ])
                     ;
 
-                    if (!$useLegacyDispatcherConfig) {
-                        $container->getDefinition('enqueue.events.async_listener')
-                            ->addTag('kernel.event_listener', [
-                                'event' => $event,
-                                'method' => 'onEvent',
-                                'dispatcher' => 'enqueue.events.event_dispatcher',
-                            ])
-                        ;
-                    }
+                    $container->getDefinition('enqueue.events.async_listener')
+                        ->addTag('kernel.event_listener', [
+                            'event' => $event,
+                            'method' => 'onEvent',
+                            'dispatcher' => 'enqueue.events.event_dispatcher',
+                        ])
+                    ;
 
                     $container->getDefinition('enqueue.events.async_processor')
                         ->addTag('enqueue.processor', [
@@ -79,11 +67,6 @@ public function process(ContainerBuilder $container): void
 
                 $service = $container->getDefinition($serviceId);
 
-                if ($useLegacyDispatcherConfig) {
-                    $service->clearTag('kernel.event_subscriber');
-                    $service->addTag('enqueue.async_event_subscriber', $tagAttribute);
-                }
-
                 /** @var EventSubscriberInterface $serviceClass */
                 $serviceClass = $service->getClass();
 
@@ -96,15 +79,13 @@ public function process(ContainerBuilder $container): void
                             ])
                         ;
 
-                        if (!$useLegacyDispatcherConfig) {
-                            $container->getDefinition('enqueue.events.async_listener')
-                                ->addTag('kernel.event_listener', [
-                                    'event' => $event,
-                                    'method' => 'onEvent',
-                                    'dispatcher' => 'enqueue.events.event_dispatcher',
-                                ])
-                            ;
-                        }
+                        $container->getDefinition('enqueue.events.async_listener')
+                            ->addTag('kernel.event_listener', [
+                                'event' => $event,
+                                'method' => 'onEvent',
+                                'dispatcher' => 'enqueue.events.event_dispatcher',
+                            ])
+                        ;
 
                         $container->getDefinition('enqueue.events.async_processor')
                             ->addTag('enqueue.processor', [
@@ -118,14 +99,5 @@ public function process(ContainerBuilder $container): void
                 }
             }
         }
-
-        if ($useLegacyDispatcherConfig) {
-            $registerListenersPass = new RegisterListenersPass(
-                'enqueue.events.event_dispatcher',
-                'enqueue.async_event_listener',
-                'enqueue.async_event_subscriber'
-            );
-            $registerListenersPass->process($container);
-        }
     }
 }
diff --git a/EventTransformer.php b/EventTransformer.php
index 352930c..cee8635 100644
--- a/EventTransformer.php
+++ b/EventTransformer.php
@@ -3,61 +3,28 @@
 namespace Enqueue\AsyncEventDispatcher;
 
 use Interop\Queue\Message;
-use Symfony\Component\EventDispatcher\Event;
-use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
+use Symfony\Contracts\EventDispatcher\Event;
 
-if (class_exists(Event::class)) {
+interface EventTransformer
+{
     /**
-     * Symfony < 5.0.
+     * @param string $eventName
+     *
+     * @return Message
      */
-    interface EventTransformer
-    {
-        /**
-         * @param string                   $eventName
-         * @param ContractEvent|Event|null $event
-         *
-         * @return Message
-         */
-        public function toMessage($eventName, $event = null);
+    public function toMessage($eventName, Event $event = null);
 
-        /**
-         * If you able to transform message back to event return it.
-         * If you failed to transform for some reason you can return a string status.
-         *
-         * @param mixed $eventName
-         *
-         * @return ContractEvent|Event|string|object
-         *
-         * @see Process constants) or an object that implements __toString method.
-         *      The object must have a __toString method is supposed to be used as Processor::process return value.
-         */
-        public function toEvent($eventName, Message $message);
-    }
-} else {
     /**
-     * Symfony >= 5.0.
+     * If you able to transform message back to event return it.
+     * If you failed to transform for some reason you can return a string status.
+     *
+     * @param mixed $eventNAme
+     * @param mixed $eventName
+     *
+     * @return Event|string|object
+     *
+     * @see Process constants) or an object that implements __toString method.
+     *      The object must have a __toString method is supposed to be used as Processor::process return value.
      */
-    interface EventTransformer
-    {
-        /**
-         * @param string $eventName
-         *
-         * @return Message
-         */
-        public function toMessage($eventName, ContractEvent $event = null);
-
-        /**
-         * If you able to transform message back to event return it.
-         * If you failed to transform for some reason you can return a string status.
-         *
-         * @param mixed $eventNAme
-         * @param mixed $eventName
-         *
-         * @return ContractEvent|string|object
-         *
-         * @see Process constants) or an object that implements __toString method.
-         *      The object must have a __toString method is supposed to be used as Processor::process return value.
-         */
-        public function toEvent($eventName, Message $message);
-    }
+    public function toEvent($eventName, Message $message);
 }
diff --git a/PhpSerializerEventTransformer.php b/PhpSerializerEventTransformer.php
index c6a3e2c..1204e95 100644
--- a/PhpSerializerEventTransformer.php
+++ b/PhpSerializerEventTransformer.php
@@ -2,29 +2,12 @@
 
 namespace Enqueue\AsyncEventDispatcher;
 
-use Symfony\Component\EventDispatcher\Event;
-use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
+use Symfony\Contracts\EventDispatcher\Event;
 
-if (class_exists(Event::class)) {
-    /**
-     * Symfony < 5.0.
-     */
-    class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
+class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
+{
+    public function toMessage($eventName, Event $event = null)
     {
-        public function toMessage($eventName, $event = null)
-        {
-            return $this->context->createMessage(serialize($event));
-        }
-    }
-} else {
-    /**
-     * Symfony >= 5.0.
-     */
-    class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
-    {
-        public function toMessage($eventName, ContractEvent $event = null)
-        {
-            return $this->context->createMessage(serialize($event));
-        }
+        return $this->context->createMessage(serialize($event));
     }
 }
diff --git a/Tests/AsyncListenerTest.php b/Tests/AsyncListenerTest.php
index f006352..d888c02 100644
--- a/Tests/AsyncListenerTest.php
+++ b/Tests/AsyncListenerTest.php
@@ -13,10 +13,8 @@
 use Interop\Queue\Producer;
 use PHPUnit\Framework\MockObject\MockObject;
 use PHPUnit\Framework\TestCase;
-use Symfony\Component\EventDispatcher\Event;
 use Symfony\Component\EventDispatcher\GenericEvent;
-use Symfony\Component\HttpKernel\Kernel;
-use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
+use Symfony\Contracts\EventDispatcher\Event;
 
 class AsyncListenerTest extends TestCase
 {
@@ -73,9 +71,7 @@ public function testShouldDoNothingIfSyncModeOn()
 
         $listener->syncMode('fooEvent');
 
-        $eventClass = Kernel::VERSION_ID >= 50000 ? ContractEvent::class : Event::class;
-
-        $listener->onEvent(new $eventClass(), 'fooEvent');
+        $listener->onEvent(new Event(), 'fooEvent');
         $listener->onEvent(new GenericEvent(), 'fooEvent');
     }
 
diff --git a/composer.json b/composer.json
index 28ed42b..3f124dc 100644
--- a/composer.json
+++ b/composer.json
@@ -9,15 +9,15 @@
         "php": "^7.3|^8.0",
         "enqueue/enqueue": "^0.10",
         "queue-interop/queue-interop": "^0.8",
-        "symfony/event-dispatcher": "^4.3|^5|^6.0"
+        "symfony/event-dispatcher": "^5.1|^6.0"
     },
     "require-dev": {
         "phpunit/phpunit": "^9.5",
-        "symfony/dependency-injection": "^4.3|^5|^6.0",
-        "symfony/config": "^4.3|^5|^6.0",
-        "symfony/http-kernel": "^4.3|^5|^6.0",
-        "symfony/filesystem": "^4.3|^5|^6.0",
-        "symfony/yaml": "^4.3|^5|^6.0",
+        "symfony/dependency-injection": "^5.1|^6.0",
+        "symfony/config": "^5.1|^6.0",
+        "symfony/http-kernel": "^5.1|^6.0",
+        "symfony/filesystem": "^5.1|^6.0",
+        "symfony/yaml": "^5.1|^6.0",
         "enqueue/null": "0.10.x-dev",
         "enqueue/fs": "0.10.x-dev",
         "enqueue/test": "0.10.x-dev"
@@ -30,7 +30,7 @@
         "docs": "https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md"
     },
     "suggest": {
-        "symfony/dependency-injection": "^2.8|^3|^4|^5 If you'd like to use async event dispatcher container extension."
+        "symfony/dependency-injection": "^5.1|^6.0 If you'd like to use async event dispatcher container extension."
     },
     "autoload": {
         "psr-4": { "Enqueue\\AsyncEventDispatcher\\": "" },

From 191ba62dff710d1d63f3245fc3c2c1c0e6747237 Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Wed, 16 Feb 2022 13:18:28 +0200
Subject: [PATCH 53/61] Remove unused uses

---
 DependencyInjection/AsyncEventsPass.php | 2 --
 1 file changed, 2 deletions(-)

diff --git a/DependencyInjection/AsyncEventsPass.php b/DependencyInjection/AsyncEventsPass.php
index 5eecd09..42774ad 100644
--- a/DependencyInjection/AsyncEventsPass.php
+++ b/DependencyInjection/AsyncEventsPass.php
@@ -4,9 +4,7 @@
 
 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
 use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-use Symfony\Component\HttpKernel\Kernel;
 
 class AsyncEventsPass implements CompilerPassInterface
 {

From 971bbeb633b22dc8a83219451b8dbb1a1735e8e8 Mon Sep 17 00:00:00 2001
From: Alex Mayer <amayer5125@gmail.com>
Date: Sat, 25 Feb 2023 22:18:02 -0500
Subject: [PATCH 54/61] Fix Shield URLs in READMEs

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index f1629b5..c4804d9 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Enqueue is an MIT-licensed open source project with its ongoing development made
 # Symfony Async Event Dispatcher.
 
 [![Gitter](https://badges.gitter.im/php-enqueue/Lobby.svg)](https://gitter.im/php-enqueue/Lobby)
-[![Build Status](https://img.shields.io/github/workflow/status/php-enqueue/async-event-dispatcher/CI)](https://github.com/php-enqueue/async-event-dispathcer/actions?query=workflow%3ACI)
+[![Build Status](https://img.shields.io/github/actions/workflow/status/php-enqueue/async-event-dispatcher/ci.yml?branch=master)](https://github.com/php-enqueue/async-event-dispathcer/actions?query=workflow%3ACI)
 [![Total Downloads](https://poser.pugx.org/enqueue/async-event-dispathcer/d/total.png)](https://packagist.org/packages/enqueue/async-event-dispatcher)
 [![Latest Stable Version](https://poser.pugx.org/enqueue/async-event-dispathcer/version.png)](https://packagist.org/packages/enqueue/async-event-dispatcher)
 

From 82f8c501c1a217a81da56cf6609914dacc614e7e Mon Sep 17 00:00:00 2001
From: Andrew M-Y <andrejs@gmail.com>
Date: Sun, 19 Feb 2023 15:13:41 +0200
Subject: [PATCH 55/61] Properly drop old PHP and Symfony versions

---
 composer.json | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/composer.json b/composer.json
index 3f124dc..a2cef0d 100644
--- a/composer.json
+++ b/composer.json
@@ -6,18 +6,18 @@
     "homepage": "https://enqueue.forma-pro.com/",
     "license": "MIT",
     "require": {
-        "php": "^7.3|^8.0",
+        "php": "^7.4|^8.0",
         "enqueue/enqueue": "^0.10",
         "queue-interop/queue-interop": "^0.8",
-        "symfony/event-dispatcher": "^5.1|^6.0"
+        "symfony/event-dispatcher": "^5.4|^6.0"
     },
     "require-dev": {
         "phpunit/phpunit": "^9.5",
-        "symfony/dependency-injection": "^5.1|^6.0",
-        "symfony/config": "^5.1|^6.0",
-        "symfony/http-kernel": "^5.1|^6.0",
-        "symfony/filesystem": "^5.1|^6.0",
-        "symfony/yaml": "^5.1|^6.0",
+        "symfony/dependency-injection": "^5.4|^6.0",
+        "symfony/config": "^5.4|^6.0",
+        "symfony/http-kernel": "^5.4|^6.0",
+        "symfony/filesystem": "^5.4|^6.0",
+        "symfony/yaml": "^5.4|^6.0",
         "enqueue/null": "0.10.x-dev",
         "enqueue/fs": "0.10.x-dev",
         "enqueue/test": "0.10.x-dev"
@@ -30,7 +30,7 @@
         "docs": "https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md"
     },
     "suggest": {
-        "symfony/dependency-injection": "^5.1|^6.0 If you'd like to use async event dispatcher container extension."
+        "symfony/dependency-injection": "^5.4|^6.0 If you'd like to use async event dispatcher container extension."
     },
     "autoload": {
         "psr-4": { "Enqueue\\AsyncEventDispatcher\\": "" },

From 8fa4296ab2112a08ca8f9968abe9c57ba1c5b7a3 Mon Sep 17 00:00:00 2001
From: Witold Wasiczko <witold@wasiczko.pl>
Date: Thu, 23 Mar 2023 10:50:55 +0100
Subject: [PATCH 56/61] Update and fix pkg test with 8.1 and 8.2 PHP support

---
 .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 a168dca..0492424 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,7 +10,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        php: ['7.3', '7.4', '8.0']
+        php: ['7.4', '8.0', '8.1', '8.2']
 
     name: PHP ${{ matrix.php }} tests
 

From d2856e4913927cfffbaec4b28c80afdac1bce71f Mon Sep 17 00:00:00 2001
From: Viktor Zavitkov <zavitkov@icloud.com>
Date: Fri, 15 Nov 2024 20:59:32 +0300
Subject: [PATCH 57/61] another tests fixed

---
 ContainerAwareRegistry.php            | 29 ++++++++------------
 DependencyInjection/Configuration.php |  5 +---
 Resources/config/services.yml         |  4 +--
 Tests/ContainerAwareRegistryTest.php  | 38 ++++++++++-----------------
 4 files changed, 27 insertions(+), 49 deletions(-)

diff --git a/ContainerAwareRegistry.php b/ContainerAwareRegistry.php
index 2763ed7..b0e23f2 100644
--- a/ContainerAwareRegistry.php
+++ b/ContainerAwareRegistry.php
@@ -2,12 +2,14 @@
 
 namespace Enqueue\AsyncEventDispatcher;
 
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
-use Symfony\Component\DependencyInjection\ContainerAwareTrait;
+use Psr\Container\ContainerInterface;
 
-class ContainerAwareRegistry implements Registry, ContainerAwareInterface
+class ContainerAwareRegistry implements Registry
 {
-    use ContainerAwareTrait;
+    /**
+     * @var ContainerInterface
+     */
+    private $container;
 
     /**
      * @var string[]
@@ -23,15 +25,13 @@ class ContainerAwareRegistry implements Registry, ContainerAwareInterface
      * @param string[] $eventsMap       [eventName => transformerName]
      * @param string[] $transformersMap [transformerName => transformerServiceId]
      */
-    public function __construct(array $eventsMap, array $transformersMap)
+    public function __construct(array $eventsMap, array $transformersMap, ContainerInterface $container)
     {
         $this->eventsMap = $eventsMap;
         $this->transformersMap = $transformersMap;
+        $this->container = $container;
     }
 
-    /**
-     * {@inheritdoc}
-     */
     public function getTransformerNameForEvent($eventName)
     {
         $transformerName = null;
@@ -39,7 +39,7 @@ public function getTransformerNameForEvent($eventName)
             $transformerName = $this->eventsMap[$eventName];
         } else {
             foreach ($this->eventsMap as $eventNamePattern => $name) {
-                if ('/' != $eventNamePattern[0]) {
+                if ('/' !== $eventNamePattern[0]) {
                     continue;
                 }
 
@@ -58,9 +58,6 @@ public function getTransformerNameForEvent($eventName)
         return $transformerName;
     }
 
-    /**
-     * {@inheritdoc}
-     */
     public function getTransformer($name)
     {
         if (false == array_key_exists($name, $this->transformersMap)) {
@@ -69,12 +66,8 @@ public function getTransformer($name)
 
         $transformer = $this->container->get($this->transformersMap[$name]);
 
-        if (false == $transformer instanceof  EventTransformer) {
-            throw new \LogicException(sprintf(
-                'The container must return instance of %s but got %s',
-                EventTransformer::class,
-                is_object($transformer) ? get_class($transformer) : gettype($transformer)
-            ));
+        if (false == $transformer instanceof EventTransformer) {
+            throw new \LogicException(sprintf('The container must return instance of %s but got %s', EventTransformer::class, is_object($transformer) ? $transformer::class : gettype($transformer)));
         }
 
         return $transformer;
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 56151e9..7b85a46 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -7,10 +7,7 @@
 
 class Configuration implements ConfigurationInterface
 {
-    /**
-     * {@inheritdoc}
-     */
-    public function getConfigTreeBuilder()
+    public function getConfigTreeBuilder(): TreeBuilder
     {
         if (method_exists(TreeBuilder::class, 'getRootNode')) {
             $tb = new TreeBuilder('enqueue_async_event_dispatcher');
diff --git a/Resources/config/services.yml b/Resources/config/services.yml
index 2b3fbc0..67365dc 100644
--- a/Resources/config/services.yml
+++ b/Resources/config/services.yml
@@ -8,9 +8,7 @@ services:
     enqueue.events.registry:
         class: 'Enqueue\AsyncEventDispatcher\ContainerAwareRegistry'
         public: false
-        arguments: [[], []]
-        calls:
-            -  ['setContainer', ['@service_container']]
+        arguments: [[], [], '@service_container']
 
     enqueue.events.async_listener:
         class: 'Enqueue\AsyncEventDispatcher\AsyncListener'
diff --git a/Tests/ContainerAwareRegistryTest.php b/Tests/ContainerAwareRegistryTest.php
index 3be3b5f..79762ac 100644
--- a/Tests/ContainerAwareRegistryTest.php
+++ b/Tests/ContainerAwareRegistryTest.php
@@ -20,37 +20,25 @@ public function testShouldImplementRegistryInterface()
         $this->assertClassImplements(Registry::class, ContainerAwareRegistry::class);
     }
 
-    public function testCouldBeConstructedWithEventsMapAndTransformersMapAsArguments()
-    {
-        new ContainerAwareRegistry([], []);
-    }
-
-    public function testShouldSetContainerToContainerProperty()
+    public function testShouldAllowGetTransportNameByEventName()
     {
         $container = new Container();
 
-        $registry = new ContainerAwareRegistry([], []);
-
-        $registry->setContainer($container);
-
-        $this->assertAttributeSame($container, 'container', $registry);
-    }
-
-    public function testShouldAllowGetTransportNameByEventName()
-    {
         $registry = new ContainerAwareRegistry([
-                'fooEvent' => 'fooTrans',
-        ], []);
+            'fooEvent' => 'fooTrans',
+        ], [], $container);
 
         $this->assertEquals('fooTrans', $registry->getTransformerNameForEvent('fooEvent'));
     }
 
     public function testShouldAllowDefineTransportNameAsRegExpPattern()
     {
+        $container = new Container();
+
         $registry = new ContainerAwareRegistry([
             '/.*/' => 'fooRegExpTrans',
             'fooEvent' => 'fooTrans',
-        ], []);
+        ], [], $container);
 
         // guard
         $this->assertEquals('fooTrans', $registry->getTransformerNameForEvent('fooEvent'));
@@ -60,9 +48,11 @@ public function testShouldAllowDefineTransportNameAsRegExpPattern()
 
     public function testThrowIfNotSupportedEventGiven()
     {
+        $container = new Container();
+
         $registry = new ContainerAwareRegistry([
             'fooEvent' => 'fooTrans',
-        ], []);
+        ], [], $container);
 
         $this->expectException(\LogicException::class);
         $this->expectExceptionMessage('There is no transformer registered for the given event fooNotSupportedEvent');
@@ -71,9 +61,11 @@ public function testThrowIfNotSupportedEventGiven()
 
     public function testThrowIfThereIsNoRegisteredTransformerWithSuchName()
     {
+        $container = new Container();
+
         $registry = new ContainerAwareRegistry([], [
             'fooTrans' => 'foo_trans_id',
-        ]);
+        ], $container);
 
         $this->expectException(\LogicException::class);
         $this->expectExceptionMessage('There is no transformer named fooNotRegisteredName');
@@ -87,8 +79,7 @@ public function testThrowIfContainerReturnsServiceNotInstanceOfEventTransformer(
 
         $registry = new ContainerAwareRegistry([], [
             'fooTrans' => 'foo_trans_id',
-        ]);
-        $registry->setContainer($container);
+        ], $container);
 
         $this->expectException(\LogicException::class);
         $this->expectExceptionMessage('The container must return instance of Enqueue\AsyncEventDispatcher\EventTransformer but got stdClass');
@@ -104,8 +95,7 @@ public function testShouldReturnEventTransformer()
 
         $registry = new ContainerAwareRegistry([], [
             'fooTrans' => 'foo_trans_id',
-        ]);
-        $registry->setContainer($container);
+        ], $container);
 
         $this->assertSame($eventTransformerMock, $registry->getTransformer('fooTrans'));
     }

From 1875263f6984de20d5c28ecc968418c5f0f0459e Mon Sep 17 00:00:00 2001
From: James Read <james.read.18@gmail.com>
Date: Sat, 11 Jan 2025 20:47:49 +0000
Subject: [PATCH 58/61] Fixing risky tests

Makring tests that have no assertions with the annotation to suppress
phpunits warning around risky tests

closes 1370
---
 Tests/AsyncProcessorTest.php                | 3 +++
 Tests/PhpSerializerEventTransformerTest.php | 3 +++
 Tests/SimpleRegistryTest.php                | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/Tests/AsyncProcessorTest.php b/Tests/AsyncProcessorTest.php
index 7237c9a..9bf2941 100644
--- a/Tests/AsyncProcessorTest.php
+++ b/Tests/AsyncProcessorTest.php
@@ -24,6 +24,9 @@ public function testShouldImplementProcessorInterface()
         $this->assertClassImplements(Processor::class, AsyncProcessor::class);
     }
 
+    /**
+     * @doesNotPerformAssertions
+     */
     public function testCouldBeConstructedWithRegistryAndProxyEventDispatcher()
     {
         new AsyncProcessor($this->createRegistryMock(), $this->createProxyEventDispatcherMock());
diff --git a/Tests/PhpSerializerEventTransformerTest.php b/Tests/PhpSerializerEventTransformerTest.php
index 49f3a93..04d9f2d 100644
--- a/Tests/PhpSerializerEventTransformerTest.php
+++ b/Tests/PhpSerializerEventTransformerTest.php
@@ -21,6 +21,9 @@ public function testShouldImplementEventTransformerInterface()
         $this->assertClassImplements(EventTransformer::class, PhpSerializerEventTransformer::class);
     }
 
+    /**
+     * @doesNotPerformAssertions
+     */
     public function testCouldBeConstructedWithoutAnyArguments()
     {
         new PhpSerializerEventTransformer($this->createContextStub());
diff --git a/Tests/SimpleRegistryTest.php b/Tests/SimpleRegistryTest.php
index 328ed17..52d6f16 100644
--- a/Tests/SimpleRegistryTest.php
+++ b/Tests/SimpleRegistryTest.php
@@ -18,6 +18,9 @@ public function testShouldImplementRegistryInterface()
         $this->assertClassImplements(Registry::class, SimpleRegistry::class);
     }
 
+    /**
+     * @doesNotPerformAssertions
+     */
     public function testCouldBeConstructedWithEventsMapAndTransformersMapAsArguments()
     {
         new SimpleRegistry([], []);

From d53eb90332fd625e703cc092feb83135ab2d7d32 Mon Sep 17 00:00:00 2001
From: James Read <james.read.18@gmail.com>
Date: Wed, 15 Jan 2025 21:17:06 +0000
Subject: [PATCH 59/61] Removing constructor tests

Removing all tests that creates a new instance but doesn't call any
methods nor preform any assertions.
---
 Tests/AsyncProcessorTest.php                | 8 --------
 Tests/PhpSerializerEventTransformerTest.php | 8 --------
 Tests/SimpleRegistryTest.php                | 8 --------
 3 files changed, 24 deletions(-)

diff --git a/Tests/AsyncProcessorTest.php b/Tests/AsyncProcessorTest.php
index 9bf2941..019f9bc 100644
--- a/Tests/AsyncProcessorTest.php
+++ b/Tests/AsyncProcessorTest.php
@@ -24,14 +24,6 @@ public function testShouldImplementProcessorInterface()
         $this->assertClassImplements(Processor::class, AsyncProcessor::class);
     }
 
-    /**
-     * @doesNotPerformAssertions
-     */
-    public function testCouldBeConstructedWithRegistryAndProxyEventDispatcher()
-    {
-        new AsyncProcessor($this->createRegistryMock(), $this->createProxyEventDispatcherMock());
-    }
-
     public function testRejectIfMessageMissingEventNameProperty()
     {
         $processor = new AsyncProcessor($this->createRegistryMock(), $this->createProxyEventDispatcherMock());
diff --git a/Tests/PhpSerializerEventTransformerTest.php b/Tests/PhpSerializerEventTransformerTest.php
index 04d9f2d..498ca3a 100644
--- a/Tests/PhpSerializerEventTransformerTest.php
+++ b/Tests/PhpSerializerEventTransformerTest.php
@@ -21,14 +21,6 @@ public function testShouldImplementEventTransformerInterface()
         $this->assertClassImplements(EventTransformer::class, PhpSerializerEventTransformer::class);
     }
 
-    /**
-     * @doesNotPerformAssertions
-     */
-    public function testCouldBeConstructedWithoutAnyArguments()
-    {
-        new PhpSerializerEventTransformer($this->createContextStub());
-    }
-
     public function testShouldReturnMessageWithPhpSerializedEventAsBodyOnToMessage()
     {
         $transformer = new PhpSerializerEventTransformer($this->createContextStub());
diff --git a/Tests/SimpleRegistryTest.php b/Tests/SimpleRegistryTest.php
index 52d6f16..82e1e3f 100644
--- a/Tests/SimpleRegistryTest.php
+++ b/Tests/SimpleRegistryTest.php
@@ -18,14 +18,6 @@ public function testShouldImplementRegistryInterface()
         $this->assertClassImplements(Registry::class, SimpleRegistry::class);
     }
 
-    /**
-     * @doesNotPerformAssertions
-     */
-    public function testCouldBeConstructedWithEventsMapAndTransformersMapAsArguments()
-    {
-        new SimpleRegistry([], []);
-    }
-
     public function testShouldAllowGetTransportNameByEventName()
     {
         $registry = new SimpleRegistry([

From 751439dc3832e108edb9f18612ad592252ed106e Mon Sep 17 00:00:00 2001
From: James Read <james.read.18@gmail.com>
Date: Wed, 15 Jan 2025 22:51:32 +0000
Subject: [PATCH 60/61] Running php-cs-fixer

Running php-cs-fixer to fix CS drift
---
 AsyncEventDispatcher.php                      |  2 +-
 AsyncProcessor.php                            |  6 +-----
 Commands.php                                  |  2 +-
 DependencyInjection/AsyncTransformersPass.php |  3 ---
 EventTransformer.php                          |  5 +----
 PhpSerializerEventTransformer.php             |  2 +-
 SimpleRegistry.php                            | 14 ++------------
 Tests/SimpleRegistryTest.php                  |  2 +-
 8 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/AsyncEventDispatcher.php b/AsyncEventDispatcher.php
index fa7393e..e39136e 100644
--- a/AsyncEventDispatcher.php
+++ b/AsyncEventDispatcher.php
@@ -4,7 +4,7 @@
 
 class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
 {
-    public function dispatch(object $event, string $eventName = null): object
+    public function dispatch(object $event, ?string $eventName = null): object
     {
         $this->parentDispatch($event, $eventName);
 
diff --git a/AsyncProcessor.php b/AsyncProcessor.php
index c89f7e1..dc61c53 100644
--- a/AsyncProcessor.php
+++ b/AsyncProcessor.php
@@ -25,11 +25,7 @@ public function __construct(Registry $registry, EventDispatcherInterface $dispat
         $this->registry = $registry;
 
         if (false == $dispatcher instanceof AsyncEventDispatcher) {
-            throw new \InvalidArgumentException(sprintf(
-                'The dispatcher argument must be instance of "%s" but got "%s"',
-                AsyncEventDispatcher::class,
-                get_class($dispatcher)
-            ));
+            throw new \InvalidArgumentException(sprintf('The dispatcher argument must be instance of "%s" but got "%s"', AsyncEventDispatcher::class, $dispatcher::class));
         }
 
         $this->dispatcher = $dispatcher;
diff --git a/Commands.php b/Commands.php
index a00ed6f..c2263ee 100644
--- a/Commands.php
+++ b/Commands.php
@@ -4,5 +4,5 @@
 
 final class Commands
 {
-    const DISPATCH_ASYNC_EVENTS = 'symfony.dispatch_async_events';
+    public const DISPATCH_ASYNC_EVENTS = 'symfony.dispatch_async_events';
 }
diff --git a/DependencyInjection/AsyncTransformersPass.php b/DependencyInjection/AsyncTransformersPass.php
index afe1021..89046dd 100644
--- a/DependencyInjection/AsyncTransformersPass.php
+++ b/DependencyInjection/AsyncTransformersPass.php
@@ -7,9 +7,6 @@
 
 class AsyncTransformersPass implements CompilerPassInterface
 {
-    /**
-     * {@inheritdoc}
-     */
     public function process(ContainerBuilder $container)
     {
         if (false == $container->hasDefinition('enqueue.events.registry')) {
diff --git a/EventTransformer.php b/EventTransformer.php
index cee8635..271dffa 100644
--- a/EventTransformer.php
+++ b/EventTransformer.php
@@ -12,15 +12,12 @@ interface EventTransformer
      *
      * @return Message
      */
-    public function toMessage($eventName, Event $event = null);
+    public function toMessage($eventName, ?Event $event = null);
 
     /**
      * If you able to transform message back to event return it.
      * If you failed to transform for some reason you can return a string status.
      *
-     * @param mixed $eventNAme
-     * @param mixed $eventName
-     *
      * @return Event|string|object
      *
      * @see Process constants) or an object that implements __toString method.
diff --git a/PhpSerializerEventTransformer.php b/PhpSerializerEventTransformer.php
index 1204e95..9c23883 100644
--- a/PhpSerializerEventTransformer.php
+++ b/PhpSerializerEventTransformer.php
@@ -6,7 +6,7 @@
 
 class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
 {
-    public function toMessage($eventName, Event $event = null)
+    public function toMessage($eventName, ?Event $event = null)
     {
         return $this->context->createMessage(serialize($event));
     }
diff --git a/SimpleRegistry.php b/SimpleRegistry.php
index 2f39d0c..e5ba16e 100644
--- a/SimpleRegistry.php
+++ b/SimpleRegistry.php
@@ -24,9 +24,6 @@ public function __construct(array $eventsMap, array $transformersMap)
         $this->transformersMap = $transformersMap;
     }
 
-    /**
-     * {@inheritdoc}
-     */
     public function getTransformerNameForEvent($eventName)
     {
         $transformerName = null;
@@ -53,9 +50,6 @@ public function getTransformerNameForEvent($eventName)
         return $transformerName;
     }
 
-    /**
-     * {@inheritdoc}
-     */
     public function getTransformer($name)
     {
         if (false == array_key_exists($name, $this->transformersMap)) {
@@ -64,12 +58,8 @@ public function getTransformer($name)
 
         $transformer = $this->transformersMap[$name];
 
-        if (false == $transformer instanceof  EventTransformer) {
-            throw new \LogicException(sprintf(
-                'The container must return instance of %s but got %s',
-                EventTransformer::class,
-                is_object($transformer) ? get_class($transformer) : gettype($transformer)
-            ));
+        if (false == $transformer instanceof EventTransformer) {
+            throw new \LogicException(sprintf('The container must return instance of %s but got %s', EventTransformer::class, is_object($transformer) ? $transformer::class : gettype($transformer)));
         }
 
         return $transformer;
diff --git a/Tests/SimpleRegistryTest.php b/Tests/SimpleRegistryTest.php
index 82e1e3f..c144e74 100644
--- a/Tests/SimpleRegistryTest.php
+++ b/Tests/SimpleRegistryTest.php
@@ -21,7 +21,7 @@ public function testShouldImplementRegistryInterface()
     public function testShouldAllowGetTransportNameByEventName()
     {
         $registry = new SimpleRegistry([
-                'fooEvent' => 'fooTrans',
+            'fooEvent' => 'fooTrans',
         ], []);
 
         $this->assertEquals('fooTrans', $registry->getTransformerNameForEvent('fooEvent'));

From ca394911843463918f7a1f0103887ca1fc220326 Mon Sep 17 00:00:00 2001
From: James Read <james.read.18@gmail.com>
Date: Sun, 27 Apr 2025 14:30:31 +0100
Subject: [PATCH 61/61] Updating composer

Updating composer.json in pkg directory to correctly reflect the
supported versions of PHP
---
 composer.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/composer.json b/composer.json
index a2cef0d..f78597a 100644
--- a/composer.json
+++ b/composer.json
@@ -6,7 +6,7 @@
     "homepage": "https://enqueue.forma-pro.com/",
     "license": "MIT",
     "require": {
-        "php": "^7.4|^8.0",
+        "php": "^8.1",
         "enqueue/enqueue": "^0.10",
         "queue-interop/queue-interop": "^0.8",
         "symfony/event-dispatcher": "^5.4|^6.0"
