upgraded dependencies
This commit is contained in:
@@ -66,25 +66,26 @@ class BinaryFileResponse extends Response
|
||||
* @param bool $autoLastModified Whether the Last-Modified header should be automatically set
|
||||
*
|
||||
* @return static
|
||||
*
|
||||
* @deprecated since Symfony 5.2, use __construct() instead.
|
||||
*/
|
||||
public static function create($file = null, $status = 200, $headers = [], $public = true, $contentDisposition = null, $autoEtag = false, $autoLastModified = true)
|
||||
public static function create($file = null, int $status = 200, array $headers = [], bool $public = true, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
|
||||
{
|
||||
trigger_deprecation('symfony/http-foundation', '5.2', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
|
||||
|
||||
return new static($file, $status, $headers, $public, $contentDisposition, $autoEtag, $autoLastModified);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the file to stream.
|
||||
*
|
||||
* @param \SplFileInfo|string $file The file to stream
|
||||
* @param string $contentDisposition
|
||||
* @param bool $autoEtag
|
||||
* @param bool $autoLastModified
|
||||
* @param \SplFileInfo|string $file The file to stream
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws FileException
|
||||
*/
|
||||
public function setFile($file, $contentDisposition = null, $autoEtag = false, $autoLastModified = true)
|
||||
public function setFile($file, string $contentDisposition = null, bool $autoEtag = false, bool $autoLastModified = true)
|
||||
{
|
||||
if (!$file instanceof File) {
|
||||
if ($file instanceof \SplFileInfo) {
|
||||
@@ -118,7 +119,7 @@ class BinaryFileResponse extends Response
|
||||
/**
|
||||
* Gets the file.
|
||||
*
|
||||
* @return File The file to stream
|
||||
* @return File
|
||||
*/
|
||||
public function getFile()
|
||||
{
|
||||
@@ -143,6 +144,8 @@ class BinaryFileResponse extends Response
|
||||
|
||||
/**
|
||||
* Automatically sets the Last-Modified header according the file modification date.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAutoLastModified()
|
||||
{
|
||||
@@ -153,6 +156,8 @@ class BinaryFileResponse extends Response
|
||||
|
||||
/**
|
||||
* Automatically sets the ETag header according to the checksum of the file.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAutoEtag()
|
||||
{
|
||||
@@ -170,7 +175,7 @@ class BinaryFileResponse extends Response
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setContentDisposition($disposition, $filename = '', $filenameFallback = '')
|
||||
public function setContentDisposition(string $disposition, string $filename = '', string $filenameFallback = '')
|
||||
{
|
||||
if ('' === $filename) {
|
||||
$filename = $this->file->getFilename();
|
||||
@@ -312,8 +317,6 @@ class BinaryFileResponse extends Response
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the file.
|
||||
*
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sendContent()
|
||||
@@ -351,7 +354,7 @@ class BinaryFileResponse extends Response
|
||||
fclose($out);
|
||||
fclose($file);
|
||||
} finally {
|
||||
if ($this->deleteFileAfterSend && file_exists($this->file->getPathname())) {
|
||||
if ($this->deleteFileAfterSend && is_file($this->file->getPathname())) {
|
||||
unlink($this->file->getPathname());
|
||||
}
|
||||
}
|
||||
@@ -364,7 +367,7 @@ class BinaryFileResponse extends Response
|
||||
*
|
||||
* @throws \LogicException when the content is not null
|
||||
*/
|
||||
public function setContent($content)
|
||||
public function setContent(?string $content)
|
||||
{
|
||||
if (null !== $content) {
|
||||
throw new \LogicException('The content cannot be set on a BinaryFileResponse instance.');
|
||||
@@ -393,11 +396,9 @@ class BinaryFileResponse extends Response
|
||||
* If this is set to true, the file will be unlinked after the request is sent
|
||||
* Note: If the X-Sendfile header is used, the deleteFileAfterSend setting will not be used.
|
||||
*
|
||||
* @param bool $shouldDelete
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function deleteFileAfterSend($shouldDelete = true)
|
||||
public function deleteFileAfterSend(bool $shouldDelete = true)
|
||||
{
|
||||
$this->deleteFileAfterSend = $shouldDelete;
|
||||
|
||||
|
Reference in New Issue
Block a user