Skip to content

Commit a947f40

Browse files
authored
Use correct method to set the Request Format
The `Request::setFormat()` signature is `public function setFormat(?string $format, $mimeTypes)` in Symfony 5.4 and `public function setFormat(?string $format, string|array $mimeTypes)` in Symfony 6. Both versions require two arguments to be passed. The example appears to be calling an incorrect method. Shouldn't it call `Request::setRequestFormat()` instead?
1 parent 828be1d commit a947f40

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Turbo/Resources/doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ Let's discover how to use Turbo Streams to enhance your `Symfony forms`_::
332332
// 🔥 The magic happens here! 🔥
333333
if (TurboBundle::STREAM_FORMAT === $request->getPreferredFormat()) {
334334
// If the request comes from Turbo, set the content type as text/vnd.turbo-stream.html and only send the HTML to update
335-
$request->setFormat(TurboBundle::STREAM_FORMAT);
335+
$request->setRequestFormat(TurboBundle::STREAM_FORMAT);
336336
return $this->render('task/success.stream.html.twig', ['task' => $task]);
337337
}
338338

0 commit comments

Comments
 (0)