Skip to content

Commit 2f8f6f0

Browse files
author
Mathieu Lemoine
committed
drop support for Symfony < 4.3
1 parent 1db1939 commit 2f8f6f0

19 files changed

+79
-219
lines changed

.travis.yml

+7-20
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,19 @@ matrix:
77
include:
88
- php: 7.1
99
sudo: false
10-
env: SYMFONY_VERSION=3.4.* PHPSTAN=true
10+
env: SYMFONY_VERSION=4.3.* PHPSTAN=true
1111
- php: 7.1
1212
sudo: false
13-
env: SYMFONY_VERSION=3.4.* PHP_CS_FIXER=true
13+
env: SYMFONY_VERSION=4.3.* PHP_CS_FIXER=true
1414
- php: 7.1
1515
sudo: false
16-
env: SYMFONY_VERSION=3.4.* UNIT_TESTS=true
17-
- php: 7.1
18-
sudo: false
19-
env: SYMFONY_VERSION=4.0.* UNIT_TESTS=true
16+
env: SYMFONY_VERSION=4.3.* UNIT_TESTS=true
2017
- php: 7.2
2118
sudo: false
22-
env: SYMFONY_VERSION=4.0.* UNIT_TESTS=true
19+
env: SYMFONY_VERSION=4.3.* UNIT_TESTS=true
2320
- php: 7.2
2421
sudo: false
2522
env: SYMFONY_VERSION=5.0.* UNIT_TESTS=true
26-
- php: 7.3
27-
sudo: false
28-
env: SYMFONY_VERSION=4.1.* UNIT_TESTS=true
29-
- php: 7.3
30-
sudo: false
31-
env: SYMFONY_VERSION=4.2.* UNIT_TESTS=true
3223
- php: 7.3
3324
sudo: false
3425
env: SYMFONY_VERSION=4.3.* UNIT_TESTS=true
@@ -38,24 +29,20 @@ matrix:
3829
- php: 7.3
3930
sudo: false
4031
env: SYMFONY_VERSION=5.0.* UNIT_TESTS=true
41-
- php: 7.1
42-
services: docker
43-
sudo: required
44-
env: SYMFONY_VERSION=3.4.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
4532
- php: 7.1
4633
sudo: required
4734
services: docker
48-
env: SYMFONY_VERSION=4.0.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
35+
env: SYMFONY_VERSION=4.3.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
4936
- php: 7.3
5037
sudo: required
5138
services: docker
5239
env: SYMFONY_VERSION=5.0.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
5340
- php: 7.1
5441
sudo: required
5542
services: docker
56-
env: SYMFONY_VERSION=3.4.* RDKAFKA_TESTS=true PREPARE_CONTAINER=true
43+
env: SYMFONY_VERSION=4.3.* RDKAFKA_TESTS=true PREPARE_CONTAINER=true
5744
allow_failures:
58-
- env: SYMFONY_VERSION=3.4.* RDKAFKA_TESTS=true PREPARE_CONTAINER=true
45+
- env: SYMFONY_VERSION=4.3.* RDKAFKA_TESTS=true PREPARE_CONTAINER=true
5946

6047
cache:
6148
directories:

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"symfony/http-kernel": "^3.4|^4",
5555
"symfony/filesystem": "^3.4|^4",
5656
"symfony/framework-bundle": "^3.4|^4",
57-
"symfony/yaml": "^3.4|^4|^5",
57+
"symfony/yaml": "^4.3|^5",
5858
"empi89/php-amqp-stubs": "*@dev",
5959
"doctrine/doctrine-bundle": "~1.2|^2",
6060
"doctrine/mongodb-odm-bundle": "^3.5|^4",

phpstan.neon

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ parameters:
1616
- pkg/simple-client/SimpleClient.php
1717
ignoreErrors:
1818
-
19-
message: Class Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy not found.
19+
message: '#Class Symfony\\Component\\EventDispatcher\\LegacyEventDispatcherProxy not found#'
2020
path: %currentWorkingDirectory%/*
2121
-
22-
message: '#.*Symfony\Contracts\EventDispatcher\Event.*#'
22+
message: '#.*Symfony\\Contracts\\EventDispatcher\\Event.*#'
2323
path: %currentWorkingDirectory%/*

pkg/amqp-tools/Tests/RabbitMqDelayPluginDelayStrategyTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -194,25 +194,31 @@ public function send(Destination $destination, Message $message): void
194194

195195
public function setDeliveryDelay(int $deliveryDelay = null): Producer
196196
{
197+
throw new \BadMethodCallException('This should not be called directly');
197198
}
198199

199200
public function getDeliveryDelay(): ?int
200201
{
202+
throw new \BadMethodCallException('This should not be called directly');
201203
}
202204

203205
public function setPriority(int $priority = null): Producer
204206
{
207+
throw new \BadMethodCallException('This should not be called directly');
205208
}
206209

207210
public function getPriority(): ?int
208211
{
212+
throw new \BadMethodCallException('This should not be called directly');
209213
}
210214

211215
public function setTimeToLive(int $timeToLive = null): Producer
212216
{
217+
throw new \BadMethodCallException('This should not be called directly');
213218
}
214219

215220
public function getTimeToLive(): ?int
216221
{
222+
throw new \BadMethodCallException('This should not be called directly');
217223
}
218224
}

pkg/async-command/composer.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
"php": ">=7.1",
1010
"enqueue/enqueue": "^0.9",
1111
"queue-interop/queue-interop": "^0.7|^0.8",
12-
"symfony/console": "^3.4|^4|^5",
13-
"symfony/process": "^3.4|^4|^5"
12+
"symfony/console": "^4.3|^5",
13+
"symfony/process": "^4.3|^5"
1414
},
1515
"require-dev": {
1616
"phpunit/phpunit": "~7.5",
17-
"symfony/dependency-injection": "^3.4|^4|^5",
18-
"symfony/config": "^3.4|^4|^5",
19-
"symfony/http-kernel": "^3.4|^4|^5",
20-
"symfony/filesystem": "^3.4|^4|^5",
21-
"symfony/yaml": "^3.4|^4|^5",
17+
"symfony/dependency-injection": "^4.3|^5",
18+
"symfony/config": "^4.3|^5",
19+
"symfony/http-kernel": "^4.3|^5",
20+
"symfony/filesystem": "^4.3|^5",
21+
"symfony/yaml": "^4.3|^5",
2222
"enqueue/null": "0.9.x-dev",
2323
"enqueue/fs": "0.9.x-dev",
2424
"enqueue/test": "0.9.x-dev"
@@ -31,7 +31,7 @@
3131
"docs": "https://github.com/php-enqueue/enqueue-dev/blob/master/docs/index.md"
3232
},
3333
"suggest": {
34-
"symfony/dependency-injection": "^3.4|^4|^5 If you'd like to use async event dispatcher container extension."
34+
"symfony/dependency-injection": "^4.3|^5 If you'd like to use async event dispatcher container extension."
3535
},
3636
"autoload": {
3737
"psr-4": { "Enqueue\\AsyncCommand\\": "" },

pkg/async-event-dispatcher/AsyncEventDispatcher.php

+2-24
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,10 @@
33
namespace Enqueue\AsyncEventDispatcher;
44

55
use Symfony\Component\EventDispatcher\Event;
6-
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
76

8-
if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
7+
if (class_exists(Event::class)) {
98
/**
10-
* Symfony < 4.3.
11-
*/
12-
class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
13-
{
14-
/**
15-
* {@inheritdoc}
16-
*/
17-
public function dispatch($eventName, Event $event = null)
18-
{
19-
$this->parentDispatch($event, $eventName);
20-
21-
$this->trueEventDispatcher->dispatch($eventName, $event);
22-
}
23-
24-
protected function parentDispatch($event, $eventName)
25-
{
26-
parent::dispatch($eventName, $event);
27-
}
28-
}
29-
} elseif (class_exists(Event::class)) {
30-
/**
31-
* Symfony >= 4.3 and < 5.0.
9+
* Symfony < 5.0.
3210
*/
3311
class AsyncEventDispatcher extends AbstractAsyncEventDispatcher
3412
{

pkg/async-event-dispatcher/AsyncListener.php

+2-30
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,11 @@
33
namespace Enqueue\AsyncEventDispatcher;
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-
public function __invoke(Event $event, $eventName)
16-
{
17-
$this->onEvent($event, $eventName);
18-
}
19-
20-
/**
21-
* @param string $eventName
22-
*/
23-
public function onEvent(Event $event, $eventName)
24-
{
25-
if (false == isset($this->syncMode[$eventName])) {
26-
$transformerName = $this->registry->getTransformerNameForEvent($eventName);
27-
28-
$message = $this->registry->getTransformer($transformerName)->toMessage($eventName, $event);
29-
$message->setProperty('event_name', $eventName);
30-
$message->setProperty('transformer_name', $transformerName);
31-
32-
$this->context->createProducer()->send($this->eventQueue, $message);
33-
}
34-
}
35-
}
36-
} elseif (class_exists(Event::class)) {
37-
/**
38-
* Symfony >= 4.3 and < 5.0.
10+
* Symfony < 5.0.
3911
*/
4012
class AsyncListener extends AbstractAsyncListener
4113
{

pkg/async-event-dispatcher/EventTransformer.php

+2-29
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,11 @@
44

55
use Interop\Queue\Message;
66
use Symfony\Component\EventDispatcher\Event;
7-
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
87
use Symfony\Contracts\EventDispatcher\Event as ContractEvent;
98

10-
if (class_exists(Event::class) && !class_exists(LegacyEventDispatcherProxy::class)) {
9+
if (class_exists(Event::class)) {
1110
/**
12-
* Symfony < 4.3.
13-
*/
14-
interface EventTransformer
15-
{
16-
/**
17-
* @param string $eventName
18-
*
19-
* @return Message
20-
*/
21-
public function toMessage($eventName, Event $event = null);
22-
23-
/**
24-
* If you able to transform message back to event return it.
25-
* If you failed to transform for some reason you can return a string status.
26-
*
27-
* @param mixed $eventName
28-
*
29-
* @return Event|string|object
30-
*
31-
* @see Process constants) or an object that implements __toString method.
32-
* The object must have a __toString method is supposed to be used as Processor::process return value.
33-
*/
34-
public function toEvent($eventName, Message $message);
35-
}
36-
} elseif (class_exists(Event::class)) {
37-
/**
38-
* Symfony >= 4.3 and < 5.0.
11+
* Symfony < 5.0.
3912
*/
4013
interface EventTransformer
4114
{

pkg/async-event-dispatcher/PhpSerializerEventTransformer.php

+2-14
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,11 @@
33
namespace Enqueue\AsyncEventDispatcher;
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 PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
14-
{
15-
public function toMessage($eventName, Event $event = null)
16-
{
17-
return $this->context->createMessage(serialize($event));
18-
}
19-
}
20-
} elseif (class_exists(Event::class)) {
21-
/**
22-
* Symfony >= 4.3 and < 5.0.
10+
* Symfony < 5.0.
2311
*/
2412
class PhpSerializerEventTransformer extends AbstractPhpSerializerEventTransformer implements EventTransformer
2513
{

pkg/async-event-dispatcher/composer.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
"php": "^7.1.3",
1010
"enqueue/enqueue": "^0.9",
1111
"queue-interop/queue-interop": "^0.7|^0.8",
12-
"symfony/event-dispatcher": "^3.4|^4|^5"
12+
"symfony/event-dispatcher": "^4.3|^5"
1313
},
1414
"require-dev": {
1515
"phpunit/phpunit": "~7.5",
16-
"symfony/dependency-injection": "^3.4|^4|^5",
17-
"symfony/config": "^3.4|^4|^5",
18-
"symfony/http-kernel": "^3.4|^4|^5",
19-
"symfony/filesystem": "^3.4|^4|^5",
20-
"symfony/yaml": "^3.4|^4|^5",
16+
"symfony/dependency-injection": "^4.3|^5",
17+
"symfony/config": "^4.3|^5",
18+
"symfony/http-kernel": "^4.3|^5",
19+
"symfony/filesystem": "^4.3|^5",
20+
"symfony/yaml": "^4.3|^5",
2121
"enqueue/null": "0.9.x-dev",
2222
"enqueue/fs": "0.9.x-dev",
2323
"enqueue/test": "0.9.x-dev"

pkg/dbal/Tests/DbalConsumerTest.php

+8
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ class InvalidMessage implements Message
220220
{
221221
public function getBody(): string
222222
{
223+
throw new \BadMethodCallException('This should not be called directly');
223224
}
224225

225226
public function setBody(string $body): void
@@ -232,6 +233,7 @@ public function setProperties(array $properties): void
232233

233234
public function getProperties(): array
234235
{
236+
throw new \BadMethodCallException('This should not be called directly');
235237
}
236238

237239
public function setProperty(string $name, $value): void
@@ -248,6 +250,7 @@ public function setHeaders(array $headers): void
248250

249251
public function getHeaders(): array
250252
{
253+
throw new \BadMethodCallException('This should not be called directly');
251254
}
252255

253256
public function setHeader(string $name, $value): void
@@ -264,6 +267,7 @@ public function setRedelivered(bool $redelivered): void
264267

265268
public function isRedelivered(): bool
266269
{
270+
throw new \BadMethodCallException('This should not be called directly');
267271
}
268272

269273
public function setCorrelationId(string $correlationId = null): void
@@ -272,6 +276,7 @@ public function setCorrelationId(string $correlationId = null): void
272276

273277
public function getCorrelationId(): ?string
274278
{
279+
throw new \BadMethodCallException('This should not be called directly');
275280
}
276281

277282
public function setMessageId(string $messageId = null): void
@@ -280,10 +285,12 @@ public function setMessageId(string $messageId = null): void
280285

281286
public function getMessageId(): ?string
282287
{
288+
throw new \BadMethodCallException('This should not be called directly');
283289
}
284290

285291
public function getTimestamp(): ?int
286292
{
293+
throw new \BadMethodCallException('This should not be called directly');
287294
}
288295

289296
public function setTimestamp(int $timestamp = null): void
@@ -296,5 +303,6 @@ public function setReplyTo(string $replyTo = null): void
296303

297304
public function getReplyTo(): ?string
298305
{
306+
throw new \BadMethodCallException('This should not be called directly');
299307
}
300308
}

0 commit comments

Comments
 (0)