Skip to content

Commit 3b6e751

Browse files
committed
minor #297 Use correct method to set the Request Format (janklan)
This PR was merged into the 2.x branch. Discussion ---------- Use correct method to set the Request Format | Q | A | ------------- | --- | Bug fix? | yes, docs | New feature? | no | Tickets | n/a | License | MIT 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? Commits ------- a947f40 Use correct method to set the Request Format
2 parents e6f66e7 + a947f40 commit 3b6e751

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)