Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 91a0760

Browse filesBrowse files
committed
[EventDispatcher] Deprecate LegacyEventDispatcherProxy.
1 parent 8c80c5b commit 91a0760
Copy full SHA for 91a0760

16 files changed

+36
-36
lines changed

‎UPGRADE-5.1.md

Copy file name to clipboardExpand all lines: UPGRADE-5.1.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
UPGRADE FROM 5.0 to 5.1
22
=======================
33

4+
EventDispatcher
5+
---------------
6+
7+
* Deprecated `LegacyEventDispatcherProxy`. Use the event dispatcher without the proxy.
8+
49
FrameworkBundle
510
---------------
611

‎UPGRADE-6.0.md

Copy file name to clipboardExpand all lines: UPGRADE-6.0.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
UPGRADE FROM 5.x to 6.0
22
=======================
33

4+
EventDispatcher
5+
---------------
6+
7+
* Removed `LegacyEventDispatcherProxy`. Use the event dispatcher without the proxy.
8+
49
FrameworkBundle
510
---------------
611

‎src/Symfony/Component/EventDispatcher/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/EventDispatcher/CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
5.1.0
5+
-----
6+
7+
* The `LegacyEventDispatcherProxy` class has been deprecated.
8+
49
5.0.0
510
-----
611

‎src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/EventDispatcher/LegacyEventDispatcherProxy.php
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313

1414
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
1515

16+
@trigger_error(sprintf('%s is deprecated. Use the event dispatcher without the proxy.', __CLASS__), E_USER_DEPRECATED);
17+
1618
/**
1719
* A helper class to provide BC/FC with the legacy signature of EventDispatcherInterface::dispatch().
1820
*
19-
* This class should be deprecated in Symfony 5.1
20-
*
2121
* @author Nicolas Grekas <p@tchwork.com>
22+
*
23+
* @deprecated since Symfony 5.1.
2224
*/
2325
final class LegacyEventDispatcherProxy
2426
{

‎src/Symfony/Component/Mailer/Mailer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Mailer.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Mailer;
1313

14-
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1514
use Symfony\Component\Mailer\Event\MessageEvent;
1615
use Symfony\Component\Mailer\Messenger\SendEmailMessage;
1716
use Symfony\Component\Mailer\Transport\TransportInterface;
@@ -32,7 +31,7 @@ public function __construct(TransportInterface $transport, MessageBusInterface $
3231
{
3332
$this->transport = $transport;
3433
$this->bus = $bus;
35-
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
34+
$this->dispatcher = $dispatcher;
3635
}
3736

3837
public function send(RawMessage $message, Envelope $envelope = null): void

‎src/Symfony/Component/Mailer/Transport/AbstractTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Transport/AbstractTransport.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Psr\Log\LoggerInterface;
1515
use Psr\Log\NullLogger;
16-
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1716
use Symfony\Component\Mailer\Envelope;
1817
use Symfony\Component\Mailer\Event\MessageEvent;
1918
use Symfony\Component\Mailer\SentMessage;
@@ -33,7 +32,7 @@ abstract class AbstractTransport implements TransportInterface
3332

3433
public function __construct(EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
3534
{
36-
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
35+
$this->dispatcher = $dispatcher;
3736
$this->logger = $logger ?: new NullLogger();
3837
}
3938

‎src/Symfony/Component/Mailer/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"php": "^7.2.5",
2020
"egulias/email-validator": "^2.1.10",
2121
"psr/log": "~1.0",
22-
"symfony/event-dispatcher": "^4.4|^5.0",
22+
"symfony/event-dispatcher": "^5.0",
2323
"symfony/mime": "^4.4|^5.0",
2424
"symfony/service-contracts": "^1.1|^2"
2525
},

‎src/Symfony/Component/Messenger/Middleware/SendMessageMiddleware.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Middleware/SendMessageMiddleware.php
+1-8Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Psr\Log\LoggerAwareTrait;
1515
use Psr\Log\NullLogger;
16-
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1716
use Symfony\Component\Messenger\Envelope;
1817
use Symfony\Component\Messenger\Event\SendMessageToTransportsEvent;
1918
use Symfony\Component\Messenger\Stamp\ReceivedStamp;
@@ -35,13 +34,7 @@ class SendMessageMiddleware implements MiddlewareInterface
3534
public function __construct(SendersLocatorInterface $sendersLocator, EventDispatcherInterface $eventDispatcher = null)
3635
{
3736
$this->sendersLocator = $sendersLocator;
38-
39-
if (null !== $eventDispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
40-
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
41-
} else {
42-
$this->eventDispatcher = $eventDispatcher;
43-
}
44-
37+
$this->eventDispatcher = $eventDispatcher;
4538
$this->logger = new NullLogger();
4639
}
4740

‎src/Symfony/Component/Messenger/Worker.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Worker.php
+1-7Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Messenger;
1313

1414
use Psr\Log\LoggerInterface;
15-
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1615
use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent;
1716
use Symfony\Component\Messenger\Event\WorkerMessageHandledEvent;
1817
use Symfony\Component\Messenger\Event\WorkerMessageReceivedEvent;
@@ -48,12 +47,7 @@ public function __construct(array $receivers, MessageBusInterface $bus, EventDis
4847
$this->receivers = $receivers;
4948
$this->bus = $bus;
5049
$this->logger = $logger;
51-
52-
if (null !== $eventDispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
53-
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
54-
} else {
55-
$this->eventDispatcher = $eventDispatcher;
56-
}
50+
$this->eventDispatcher = $eventDispatcher;
5751
}
5852

5953
/**

‎src/Symfony/Component/Messenger/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/composer.json
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"doctrine/persistence": "^1.3",
2626
"symfony/console": "^4.4|^5.0",
2727
"symfony/dependency-injection": "^4.4|^5.0",
28-
"symfony/event-dispatcher": "^4.4|^5.0",
28+
"symfony/event-dispatcher": "^5.0",
2929
"symfony/http-kernel": "^4.4|^5.0",
3030
"symfony/process": "^4.4|^5.0",
3131
"symfony/property-access": "^4.4|^5.0",
@@ -36,7 +36,7 @@
3636
},
3737
"conflict": {
3838
"doctrine/persistence": "<1.3",
39-
"symfony/event-dispatcher": "<4.4",
39+
"symfony/event-dispatcher": "<5",
4040
"symfony/framework-bundle": "<4.4",
4141
"symfony/http-kernel": "<4.4"
4242
},

‎src/Symfony/Component/Notifier/Chatter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Chatter.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Notifier;
1313

14+
use Symfony\Component\EventDispatcher\Event;
1415
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1516
use Symfony\Component\Messenger\MessageBusInterface;
1617
use Symfony\Component\Notifier\Event\MessageEvent;
@@ -33,7 +34,7 @@ public function __construct(TransportInterface $transport, MessageBusInterface $
3334
{
3435
$this->transport = $transport;
3536
$this->bus = $bus;
36-
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
37+
$this->dispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
3738
}
3839

3940
public function __toString(): string

‎src/Symfony/Component/Notifier/Texter.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Texter.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Notifier;
1313

14+
use Symfony\Component\EventDispatcher\Event;
1415
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1516
use Symfony\Component\Messenger\MessageBusInterface;
1617
use Symfony\Component\Notifier\Event\MessageEvent;
@@ -33,7 +34,7 @@ public function __construct(TransportInterface $transport, MessageBusInterface $
3334
{
3435
$this->transport = $transport;
3536
$this->bus = $bus;
36-
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
37+
$this->dispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
3738
}
3839

3940
public function __toString(): string

‎src/Symfony/Component/Notifier/Transport/AbstractTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Transport/AbstractTransport.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Notifier\Transport;
1313

14+
use Symfony\Component\EventDispatcher\Event;
1415
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1516
use Symfony\Component\HttpClient\HttpClient;
1617
use Symfony\Component\Notifier\Event\MessageEvent;
@@ -45,7 +46,7 @@ public function __construct(HttpClientInterface $client = null, EventDispatcherI
4546
$this->client = HttpClient::create();
4647
}
4748

48-
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
49+
$this->dispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
4950
}
5051

5152
/**

‎src/Symfony/Component/Notifier/Transport/AbstractTransportFactory.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Transport/AbstractTransportFactory.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
namespace Symfony\Component\Notifier\Transport;
1313

14+
use Symfony\Component\EventDispatcher\Event;
1415
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1516
use Symfony\Component\Notifier\Exception\IncompleteDsnException;
1617
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
1718
use Symfony\Contracts\HttpClient\HttpClientInterface;
1819

1920
/**
2021
* @author Konstantin Myakshin <molodchick@gmail.com>
21-
*
2222
* @author Fabien Potencier <fabien@symfony.com>
2323
*
2424
* @experimental in 5.0
@@ -30,7 +30,7 @@ abstract class AbstractTransportFactory implements TransportFactoryInterface
3030

3131
public function __construct(EventDispatcherInterface $dispatcher = null, HttpClientInterface $client = null)
3232
{
33-
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
33+
$this->dispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
3434
$this->client = $client;
3535
}
3636

‎src/Symfony/Component/Security/Http/Firewall/ContextListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Firewall/ContextListener.php
+1-7Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Security\Http\Firewall;
1313

1414
use Psr\Log\LoggerInterface;
15-
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1615
use Symfony\Component\HttpFoundation\Request;
1716
use Symfony\Component\HttpFoundation\Session\Session;
1817
use Symfony\Component\HttpKernel\Event\RequestEvent;
@@ -66,12 +65,7 @@ public function __construct(TokenStorageInterface $tokenStorage, iterable $userP
6665
$this->userProviders = $userProviders;
6766
$this->sessionKey = '_security_'.$contextKey;
6867
$this->logger = $logger;
69-
70-
if (null !== $dispatcher && class_exists(LegacyEventDispatcherProxy::class)) {
71-
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
72-
} else {
73-
$this->dispatcher = $dispatcher;
74-
}
68+
$this->dispatcher = $dispatcher;
7569

7670
$this->trustResolver = $trustResolver ?: new AuthenticationTrustResolver(AnonymousToken::class, RememberMeToken::class);
7771
$this->sessionTrackerEnabler = $sessionTrackerEnabler;

‎src/Symfony/Component/Security/Http/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/composer.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"psr/log": "~1.0"
2929
},
3030
"conflict": {
31+
"symfony/event-dispatcher": "<5",
3132
"symfony/security-csrf": "<4.4"
3233
},
3334
"suggest": {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.