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);

        return $response;
    }
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);

        return $response;
    }
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 ) ; return $ response ; }
Returns a BinaryFileResponse object with original or customized file name and disposition header.

@param \SplFileInfo|string $file File object or path to file to be sent as response

@final
Returns a BinaryFileResponse object with original or customized file name and disposition header .