Skip to content

Commit 96fcc17

Browse files
committed
gracefully handle missing event dispatchers
1 parent 8c46ea7 commit 96fcc17

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)