Skip to content

Commit 9dc5743

Browse files
committed
bug #34854 [Messenger] gracefully handle missing event dispatchers (xabbuh)
This PR was merged into the 4.3 branch. Discussion ---------- [Messenger] gracefully handle missing event dispatchers | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #34852 | License | MIT | Doc PR | Commits ------- d4ae85fc72 gracefully handle missing event dispatchers
2 parents 66fdc5a + 96fcc17 commit 9dc5743

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Authorization/Voter/TraceableVoter.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ class TraceableVoter implements VoterInterface
3131
public function __construct(VoterInterface $voter, EventDispatcherInterface $eventDispatcher)
3232
{
3333
$this->voter = $voter;
34-
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
34+
35+
if (class_exists(LegacyEventDispatcherProxy::class)) {
36+
$this->eventDispatcher = LegacyEventDispatcherProxy::decorate($eventDispatcher);
37+
} else {
38+
$this->eventDispatcher = $eventDispatcher;
39+
}
3540
}
3641

3742
public function vote(TokenInterface $token, $subject, array $attributes)

0 commit comments

Comments
 (0)