Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit f1370a1

Browse files
authored
Merge pull request #69 from Codeception/issue-5796
Improved detection of event-dispatcher version
2 parents ee0c1fa + 2bba858 commit f1370a1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/DispatcherWrapper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Symfony\Component\EventDispatcher\Event;
66
use Symfony\Component\EventDispatcher\EventDispatcher;
7+
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface;
78

89
trait DispatcherWrapper
910
{
@@ -15,7 +16,8 @@ trait DispatcherWrapper
1516
*/
1617
protected function dispatch(EventDispatcher $dispatcher, $eventType, Event $eventObject)
1718
{
18-
if (class_exists('Symfony\Contracts\EventDispatcher\Event')) {
19+
//TraceableEventDispatcherInterface was introduced in symfony/event-dispatcher 2.5 and removed in 5.0
20+
if (!interface_exists(TraceableEventDispatcherInterface::class)) {
1921
//Symfony 5
2022
$dispatcher->dispatch($eventObject, $eventType);
2123
} else {

0 commit comments

Comments
 (0)