Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Bundle/Controller/ControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ protected function json($data, int $status = 200, array $headers = [], array $co
*
* @final
*/
protected function file($file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT): BinaryFileResponse
protected function file($file, ?string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT): BinaryFileResponse
{
$response = new BinaryFileResponse($file);
$response->setContentDisposition($disposition, null === $fileName ? $response->getFile()->getFilename() : $fileName);
Expand Down Expand Up @@ -236,7 +236,7 @@ protected function renderView(string $view, array $parameters = []): string
protected function render(
string $view,
array $parameters = [],
Response $response = null,
?Response $response = null,
?int $responseCode = null
): Response {
if ($this->container->has('templating')) {
Expand Down Expand Up @@ -266,7 +266,7 @@ protected function render(
*
* @final
*/
protected function stream(string $view, array $parameters = [], StreamedResponse $response = null): StreamedResponse
protected function stream(string $view, array $parameters = [], ?StreamedResponse $response = null): StreamedResponse
{
if ($this->container->has('templating')) {
@trigger_error('Using the "templating" service is deprecated since Symfony 4.3 and will be removed in 5.0; use Twig instead.', \E_USER_DEPRECATED);
Expand Down Expand Up @@ -304,7 +304,7 @@ protected function stream(string $view, array $parameters = [], StreamedResponse
*
* @final
*/
protected function createNotFoundException(string $message = 'Not Found', \Throwable $previous = null): NotFoundHttpException
protected function createNotFoundException(string $message = 'Not Found', ?\Throwable $previous = null): NotFoundHttpException
{
return new NotFoundHttpException($message, $previous);
}
Expand All @@ -320,7 +320,7 @@ protected function createNotFoundException(string $message = 'Not Found', \Throw
*
* @final
*/
protected function createAccessDeniedException(string $message = 'Access Denied.', \Throwable $previous = null): AccessDeniedException
protected function createAccessDeniedException(string $message = 'Access Denied.', ?\Throwable $previous = null): AccessDeniedException
{
if (!class_exists(AccessDeniedException::class)) {
throw new \LogicException('You can not use the "createAccessDeniedException" method if the Security component is not available. Try running "composer require symfony/security-bundle".');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ final class HttpFoundationRequestHandler implements RequestHandlerInterface
{
private ServerParams $serverParams;

public function __construct(ServerParams $serverParams = null)
public function __construct(?ServerParams $serverParams = null)
{
$this->serverParams = $serverParams ?: new ServerParams();
}

public function handleRequest(FormInterface $form, mixed $request = null): void
{
if (!$request instanceof Request) {
throw new UnexpectedTypeException($request, 'Symfony\Component\HttpFoundation\Request');
throw new UnexpectedTypeException($request, Request::class);
}

$name = $form->getName();
Expand Down