package and depencies

This commit is contained in:
RafficMohammed
2023-01-08 02:57:24 +05:30
parent d5332eb421
commit 1d54b8bc7f
4309 changed files with 193331 additions and 172289 deletions

View File

@@ -34,7 +34,7 @@ final class FormDataPart extends AbstractMultipartPart
foreach ($fields as $name => $value) {
if (!\is_string($value) && !\is_array($value) && !$value instanceof TextPart) {
throw new InvalidArgumentException(sprintf('A form field value can only be a string, an array, or an instance of TextPart ("%s" given).', get_debug_type($value)));
throw new InvalidArgumentException(sprintf('The value of the form field "%s" can only be a string, an array, or an instance of TextPart ("%s" given).', $name, get_debug_type($value)));
}
$this->fields[$name] = $value;
@@ -83,7 +83,7 @@ final class FormDataPart extends AbstractMultipartPart
return $values;
}
private function preparePart(string $name, $value): TextPart
private function preparePart(string $name, string|TextPart $value): TextPart
{
if (\is_string($value)) {
return $this->configurePart($name, new TextPart($value, 'utf-8', 'plain', '8bit'));
@@ -96,10 +96,7 @@ final class FormDataPart extends AbstractMultipartPart
{
static $r;
if (null === $r) {
$r = new \ReflectionProperty(TextPart::class, 'encoding');
$r->setAccessible(true);
}
$r ??= new \ReflectionProperty(TextPart::class, 'encoding');
$part->setDisposition('form-data');
$part->setName($name);