remove bc break code

This commit is contained in:
walidboughdiri 2019-05-31 11:58:21 +02:00 committed by walid boughdiri
parent 957a0b82cb
commit 8a09579d35

View File

@ -28,6 +28,7 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Messenger\Envelope; use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Stamp\StampInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Csrf\CsrfToken; use Symfony\Component\Security\Csrf\CsrfToken;
@ -397,18 +398,19 @@ trait ControllerTrait
/** /**
* Dispatches a message to the bus. * Dispatches a message to the bus.
* *
* @param object|Envelope $message The message or the message pre-wrapped in an envelope * @param object|Envelope $message The message or the message pre-wrapped in an envelope
* @param StampInterface[] $stamps
* *
* @final * @final
*/ */
protected function dispatchMessage($message): Envelope protected function dispatchMessage($message, array $stamps = []): Envelope
{ {
if (!$this->container->has('messenger.default_bus')) { if (!$this->container->has('messenger.default_bus')) {
$message = class_exists(Envelope::class) ? 'You need to define the "messenger.default_bus" configuration option.' : 'Try running "composer require symfony/messenger".'; $message = class_exists(Envelope::class) ? 'You need to define the "messenger.default_bus" configuration option.' : 'Try running "composer require symfony/messenger".';
throw new \LogicException('The message bus is not enabled in your application. '.$message); throw new \LogicException('The message bus is not enabled in your application. '.$message);
} }
return $this->container->get('messenger.default_bus')->dispatch($message); return $this->container->get('messenger.default_bus')->dispatch($message, $stamps);
} }
/** /**