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 c7e612d

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

File tree

14 files changed

+38
-28
lines changed
Filter options

14 files changed

+38
-28
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 since Symfony 5.1, use the event dispatcher without the proxy.', LegacyEventDispatcherProxy::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
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Mailer;
1313

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

3839
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
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Psr\Log\LoggerInterface;
1515
use Psr\Log\NullLogger;
16+
use Symfony\Component\EventDispatcher\Event;
1617
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1718
use Symfony\Component\Mailer\Envelope;
1819
use Symfony\Component\Mailer\Event\MessageEvent;
@@ -33,7 +34,7 @@ abstract class AbstractTransport implements TransportInterface
3334

3435
public function __construct(EventDispatcherInterface $dispatcher = null, LoggerInterface $logger = null)
3536
{
36-
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
37+
$this->dispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
3738
$this->logger = $logger ?: new NullLogger();
3839
}
3940

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

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

1414
use Psr\Log\LoggerAwareTrait;
1515
use Psr\Log\NullLogger;
16+
use Symfony\Component\EventDispatcher\Event;
1617
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1718
use Symfony\Component\Messenger\Envelope;
1819
use Symfony\Component\Messenger\Event\SendMessageToTransportsEvent;
@@ -35,13 +36,7 @@ class SendMessageMiddleware implements MiddlewareInterface
3536
public function __construct(SendersLocatorInterface $sendersLocator, EventDispatcherInterface $eventDispatcher = null)
3637
{
3738
$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-
39+
$this->eventDispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($eventDispatcher) : $eventDispatcher;
4540
$this->logger = new NullLogger();
4641
}
4742

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

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

1414
use Psr\Log\LoggerInterface;
15+
use Symfony\Component\EventDispatcher\Event;
1516
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1617
use Symfony\Component\Messenger\Event\WorkerMessageFailedEvent;
1718
use Symfony\Component\Messenger\Event\WorkerMessageHandledEvent;
@@ -48,12 +49,7 @@ public function __construct(array $receivers, MessageBusInterface $bus, EventDis
4849
$this->receivers = $receivers;
4950
$this->bus = $bus;
5051
$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-
}
52+
$this->eventDispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($eventDispatcher) : $eventDispatcher;
5753
}
5854

5955
/**

‎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
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Security\Http\Firewall;
1313

1414
use Psr\Log\LoggerInterface;
15+
use Symfony\Component\EventDispatcher\Event;
1516
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
1617
use Symfony\Component\HttpFoundation\Request;
1718
use Symfony\Component\HttpFoundation\Session\Session;
@@ -66,12 +67,7 @@ public function __construct(TokenStorageInterface $tokenStorage, iterable $userP
6667
$this->userProviders = $userProviders;
6768
$this->sessionKey = '_security_'.$contextKey;
6869
$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-
}
70+
$this->dispatcher = class_exists(Event::class) ? LegacyEventDispatcherProxy::decorate($dispatcher) : $dispatcher;
7571

7672
$this->trustResolver = $trustResolver ?: new AuthenticationTrustResolver(AnonymousToken::class, RememberMeToken::class);
7773
$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": "<4.3",
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.