Skip to content

Commit 53a98ed

Browse files
author
Mathieu Lemoine
committed
drop support for Symfony < 4.3
1 parent 6177b04 commit 53a98ed

File tree

3 files changed

+8
-68
lines changed

3 files changed

+8
-68
lines changed

Tests/Functional/App/AsyncListener.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,11 @@
33
namespace Enqueue\Bundle\Tests\Functional\App;
44

55
use Symfony\Component\EventDispatcher\Event;
6-
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
76
use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
87

9-
if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
8+
if (class_exists(Event::class)) {
109
/**
11-
* Symfony < 4.3.
12-
*/
13-
class AsyncListener extends AbstractAsyncListener
14-
{
15-
/**
16-
* @param string $eventName
17-
*/
18-
public function onEvent(Event $event, $eventName)
19-
{
20-
$this->onEventInternal($event, $eventName);
21-
}
22-
}
23-
} elseif (class_exists(Event::class)) {
24-
/**
25-
* Symfony >= 4.3 and < 5.0.
10+
* Symfony < 5.0.
2611
*/
2712
class AsyncListener extends AbstractAsyncListener
2813
{

Tests/Functional/App/TestAsyncEventTransformer.php

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,56 +8,11 @@
88
use Interop\Queue\Message;
99
use Symfony\Component\EventDispatcher\Event;
1010
use Symfony\Component\EventDispatcher\GenericEvent;
11-
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1211
use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
1312

14-
if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
13+
if (class_exists(Event::class)) {
1514
/**
16-
* Symfony < 4.3.
17-
*/
18-
class TestAsyncEventTransformer implements EventTransformer
19-
{
20-
/**
21-
* @var Context
22-
*/
23-
private $context;
24-
25-
public function __construct(Context $context)
26-
{
27-
$this->context = $context;
28-
}
29-
30-
public function toMessage($eventName, Event $event = null)
31-
{
32-
if (Event::class === get_class($event)) {
33-
return $this->context->createMessage(json_encode(''));
34-
}
35-
36-
/** @var GenericEvent $event */
37-
if (false == $event instanceof GenericEvent) {
38-
throw new \LogicException('Must be GenericEvent');
39-
}
40-
41-
return $this->context->createMessage(json_encode([
42-
'subject' => $event->getSubject(),
43-
'arguments' => $event->getArguments(),
44-
]));
45-
}
46-
47-
public function toEvent($eventName, Message $message)
48-
{
49-
$data = JSON::decode($message->getBody());
50-
51-
if ('' === $data) {
52-
return new Event();
53-
}
54-
55-
return new GenericEvent($data['subject'], $data['arguments']);
56-
}
57-
}
58-
} elseif (class_exists(Event::class)) {
59-
/**
60-
* Symfony >= 4.3 and < 5.0.
15+
* Symfony < 5.0.
6116
*/
6217
class TestAsyncEventTransformer implements EventTransformer
6318
{

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "MIT",
88
"require": {
99
"php": "^7.1.3",
10-
"symfony/framework-bundle": "^3.4|^4|^5",
10+
"symfony/framework-bundle": "^4.3|^5",
1111
"queue-interop/amqp-interop": "^0.8",
1212
"queue-interop/queue-interop": "^0.7|^0.8",
1313
"enqueue/enqueue": "^0.9",
@@ -39,9 +39,9 @@
3939
"doctrine/doctrine-bundle": "~1.2|^2",
4040
"doctrine/mongodb-odm-bundle": "^3.5|^4",
4141
"alcaeus/mongo-php-adapter": "^1.0",
42-
"symfony/browser-kit": "^3.4|^4|^5",
43-
"symfony/expression-language": "^3.4|^4|^5",
44-
"symfony/yaml": "^3.4|^4|^5"
42+
"symfony/browser-kit": "^4.3|^5",
43+
"symfony/expression-language": "^4.3|^5",
44+
"symfony/yaml": "^4.3|^5"
4545
},
4646
"suggest": {
4747
"enqueue/async-command": "If want to run Symfony command via message queue",

0 commit comments

Comments
 (0)