8000 bug #50093 [RemoteEvent] Fix ConsumerInterface usage (fabpot) · symfony/symfony@f2b7403 · GitHub
[go: up one dir, main page]

10000
Skip to content

Commit f2b7403

Browse files
committed
bug #50093 [RemoteEvent] Fix ConsumerInterface usage (fabpot)
This PR was merged into the 6.3 branch. Discussion ---------- [RemoteEvent] Fix ConsumerInterface usage | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #50025 | License | MIT | Doc PR | Commits ------- f5d874e [RemoteEvent] Fix ConsumerInterface usage
2 parents e7ccb96 + f5d874e commit f2b7403

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Component/RemoteEvent/Messenger/ConsumeRemoteEventHandler.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\RemoteEvent\Messenger;
1313

1414
use Psr\Container\ContainerInterface;
15+
use Symfony\Component\RemoteEvent\Consumer\ConsumerInterface;
1516
use Symfony\Component\RemoteEvent\Exception\LogicException;
1617

1718
/**
@@ -33,6 +34,10 @@ public function __invoke(ConsumeRemoteEventMessage $message): void
3334
}
3435
$consumer = $this->consumers->get($message->getType());
3536

37+
if (!$consumer instanceof ConsumerInterface) {
38+
throw new LogicException(sprintf('The consumer "%s" for message of type "%s" must implement "%s".', get_debug_type($consumer), $message->getType(), ConsumerInterface::class));
39+
}
40+
3641
$consumer->consume($message->getEvent());
3742
}
3843
}

0 commit comments

Comments
 (0)
0