Skip to content

Commit b1b7cb1

Browse files
committed
minor #13234 [MercureBundle] Use PublisherInterface (matthieumota)
This PR was submitted for the 5.0 branch but it was squashed and merged into the 4.4 branch instead. Discussion ---------- [MercureBundle] Use PublisherInterface We must use ```PublisherInterface``` to inject ```Publisher``` service. It can cause a bug due to argument type on controller who is ```TraceablePublisher``` when profiler is enabled. Commits ------- 42581bb [MercureBundle] Use PublisherInterface
2 parents 0e8dfc6 + 42581bb commit b1b7cb1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mercure.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ service, including controllers::
149149
namespace App\Controller;
150150

151151
use Symfony\Component\HttpFoundation\Response;
152-
use Symfony\Component\Mercure\Publisher;
152+
use Symfony\Component\Mercure\PublisherInterface;
153153
use Symfony\Component\Mercure\Update;
154154

155155
class PublishController
156156
{
157-
public function __invoke(Publisher $publisher): Response
157+
public function __invoke(PublisherInterface $publisher): Response
158158
{
159159
$update = new Update(
160160
'http://example.com/books/1',
@@ -286,7 +286,7 @@ by using the ``AbstractController::addLink`` helper method::
286286
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
287287
use Symfony\Component\HttpFoundation\JsonResponse;
288288
use Symfony\Component\HttpFoundation\Request;
289-
use Symfony\Component\WebLink\LInk;
289+
use Symfony\Component\WebLink\Link;
290290

291291
class DiscoverController extends AbstractController
292292
{
@@ -336,12 +336,12 @@ as the third parameter of the ``Update`` constructor::
336336
namespace App\Controller;
337337

338338
use Symfony\Component\HttpFoundation\Response;
339-
use Symfony\Component\Mercure\Publisher;
339+
use Symfony\Component\Mercure\PublisherInterface;
340340
use Symfony\Component\Mercure\Update;
341341

342342
class PublishController
343343
{
344-
public function __invoke(Publisher $publisher): Response
344+
public function __invoke(PublisherInterface $publisher): Response
345345
{
346346
$update = new Update(
347347
'http://example.com/books/1',

0 commit comments

Comments
 (0)