Skip to content

Commit 2e883cc

Browse files
committed
[EventDispatcher] Deprecate LegacyEventDispatcherProxy.
1 parent 3d89544 commit 2e883cc

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

Chatter.php

Lines 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

Texter.php

Lines 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

Transport/AbstractTransport.php

Lines 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
/**

Transport/AbstractTransportFactory.php

Lines 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

0 commit comments

Comments
 (0)