8000 minor #48453 [AbstractController] Using coalescing operator (BASAKSemih) · symfony/symfony@8fa4800 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 8fa4800

Browse files
minor #48453 [AbstractController] Using coalescing operator (BASAKSemih)
This PR was submitted for the 5.4 branch but it was merged into the 6.3 branch instead. Discussion ---------- [AbstractController] Using coalescing operator | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- 3de59c9 feat: using coalescing operator in file function
2 parents 116784b + 3de59c9 commit 8fa4800

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ protected function json(mixed $data, int $status = 200, array $headers = [], arr
166166
protected function file(\SplFileInfo|string $file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT): BinaryFileResponse
167167
{
168168
$response = new BinaryFileResponse($file);
169-
$response->setContentDisposition($disposition, null === $fileName ? $response->getFile()->getFilename() : $fileName);
169+
$response->setContentDisposition($disposition, $fileName ?? $response->getFile()->getFilename());
170170

171171
return $response;
172172
}

0 commit comments

Comments
 (0)
0