🔧
This commit is contained in:
4
vendor/symfony/mime/Part/DataPart.php
vendored
4
vendor/symfony/mime/Part/DataPart.php
vendored
@@ -29,7 +29,7 @@ class DataPart extends TextPart
|
||||
/**
|
||||
* @param resource|string|File $body Use a File instance to defer loading the file until rendering
|
||||
*/
|
||||
public function __construct($body, string $filename = null, string $contentType = null, string $encoding = null)
|
||||
public function __construct($body, ?string $filename = null, ?string $contentType = null, ?string $encoding = null)
|
||||
{
|
||||
if ($body instanceof File && !$filename) {
|
||||
$filename = $body->getFilename();
|
||||
@@ -47,7 +47,7 @@ class DataPart extends TextPart
|
||||
$this->setDisposition('attachment');
|
||||
}
|
||||
|
||||
public static function fromPath(string $path, string $name = null, string $contentType = null): self
|
||||
public static function fromPath(string $path, ?string $name = null, ?string $contentType = null): self
|
||||
{
|
||||
return new self(new File($path), $name, $contentType);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Symfony\Component\Mime\Part\Multipart;
|
||||
|
||||
use Symfony\Component\Mime\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Mime\Part\AbstractMultipartPart;
|
||||
use Symfony\Component\Mime\Part\DataPart;
|
||||
use Symfony\Component\Mime\Part\TextPart;
|
||||
|
||||
/**
|
||||
@@ -26,7 +25,7 @@ final class FormDataPart extends AbstractMultipartPart
|
||||
private array $fields = [];
|
||||
|
||||
/**
|
||||
* @param array<string|array|DataPart> $fields
|
||||
* @param array<string|array|TextPart> $fields
|
||||
*/
|
||||
public function __construct(array $fields = [])
|
||||
{
|
||||
|
||||
8
vendor/symfony/mime/Part/TextPart.php
vendored
8
vendor/symfony/mime/Part/TextPart.php
vendored
@@ -40,7 +40,7 @@ class TextPart extends AbstractPart
|
||||
/**
|
||||
* @param resource|string|File $body Use a File instance to defer loading the file until rendering
|
||||
*/
|
||||
public function __construct($body, ?string $charset = 'utf-8', string $subtype = 'plain', string $encoding = null)
|
||||
public function __construct($body, ?string $charset = 'utf-8', string $subtype = 'plain', ?string $encoding = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -123,7 +123,11 @@ class TextPart extends AbstractPart
|
||||
public function getBody(): string
|
||||
{
|
||||
if ($this->body instanceof File) {
|
||||
return file_get_contents($this->body->getPath());
|
||||
if (false === $ret = @file_get_contents($this->body->getPath())) {
|
||||
throw new InvalidArgumentException(error_get_last()['message']);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if (null === $this->seekable) {
|
||||
|
||||
Reference in New Issue
Block a user