update patch 1

This commit is contained in:
fiqhpratama
2024-12-02 01:18:34 +07:00
parent 453d9bb470
commit 25026b0a85
3380 changed files with 103529 additions and 363623 deletions
+24 -4
View File
@@ -42,7 +42,7 @@ final class Address
public function __construct(string $address, string $name = '')
{
if (!class_exists(EmailValidator::class)) {
throw new LogicException(sprintf('The "%s" class cannot be used as it needs "%s". Try running "composer require egulias/email-validator".', __CLASS__, EmailValidator::class));
throw new LogicException(\sprintf('The "%s" class cannot be used as it needs "%s". Try running "composer require egulias/email-validator".', __CLASS__, EmailValidator::class));
}
self::$validator ??= new EmailValidator();
@@ -51,7 +51,7 @@ final class Address
$this->name = trim(str_replace(["\n", "\r"], '', $name));
if (!self::$validator->isValid($this->address, class_exists(MessageIDValidation::class) ? new MessageIDValidation() : new RFCValidation())) {
throw new RfcComplianceException(sprintf('Email "%s" does not comply with addr-spec of RFC 2822.', $address));
throw new RfcComplianceException(\sprintf('Email "%s" does not comply with addr-spec of RFC 2822.', $address));
}
}
@@ -83,7 +83,7 @@ final class Address
return '';
}
return sprintf('"%s"', preg_replace('/"/u', '\"', $this->getName()));
return \sprintf('"%s"', preg_replace('/"/u', '\"', $this->getName()));
}
public static function create(self|string $address): self
@@ -97,7 +97,7 @@ final class Address
}
if (!preg_match(self::FROM_STRING_PATTERN, $address, $matches)) {
throw new InvalidArgumentException(sprintf('Could not parse "%s" to a "%s" instance.', $address, self::class));
throw new InvalidArgumentException(\sprintf('Could not parse "%s" to a "%s" instance.', $address, self::class));
}
return new self($matches['addrSpec'], trim($matches['displayName'], ' \'"'));
@@ -117,4 +117,24 @@ final class Address
return $addrs;
}
/**
* Returns true if this address' localpart contains at least one
* non-ASCII character, and false if it is only ASCII (or empty).
*
* This is a helper for Envelope, which has to decide whether to
* the SMTPUTF8 extensions (RFC 6530 and following) for any given
* message.
*
* The SMTPUTF8 extension is strictly required if any address
* contains a non-ASCII character in its localpart. If non-ASCII
* is only used in domains (e.g. horst@freiherr-von-mühlhausen.de)
* then it is possible to send the message using IDN encoding
* instead of SMTPUTF8. The most common software will display the
* message as intended.
*/
public function hasUnicodeLocalpart(): bool
{
return (bool) preg_match('/[\x80-\xFF].*@/', $this->address);
}
}
+2 -2
View File
@@ -62,7 +62,7 @@ final class DkimSigner
{
$options += $this->defaultOptions;
if (!\in_array($options['algorithm'], [self::ALGO_SHA256, self::ALGO_ED25519], true)) {
throw new InvalidArgumentException(sprintf('Invalid DKIM signing algorithm "%s".', $options['algorithm']));
throw new InvalidArgumentException(\sprintf('Invalid DKIM signing algorithm "%s".', $options['algorithm']));
}
$headersToIgnore['return-path'] = true;
$headersToIgnore['x-transport'] = true;
@@ -119,7 +119,7 @@ final class DkimSigner
throw new RuntimeException('Unable to sign DKIM hash: '.openssl_error_string());
}
} else {
throw new \RuntimeException(sprintf('The "%s" DKIM signing algorithm is not supported yet.', self::ALGO_ED25519));
throw new \RuntimeException(\sprintf('The "%s" DKIM signing algorithm is not supported yet.', self::ALGO_ED25519));
}
$header->setValue($value.' b='.trim(chunk_split(base64_encode($signature), 73, ' ')));
$headers->add($header);
+1 -1
View File
@@ -24,7 +24,7 @@ abstract class SMime
protected function normalizeFilePath(string $path): string
{
if (!file_exists($path)) {
throw new RuntimeException(sprintf('File does not exist: "%s".', $path));
throw new RuntimeException(\sprintf('File does not exist: "%s".', $path));
}
return 'file://'.str_replace('\\', '/', realpath($path));
+1 -1
View File
@@ -49,7 +49,7 @@ final class SMimeEncrypter extends SMime
$this->iteratorToFile($message->toIterable(), $bufferFile);
if (!@openssl_pkcs7_encrypt(stream_get_meta_data($bufferFile)['uri'], stream_get_meta_data($outputFile)['uri'], $this->certs, [], 0, $this->cipher)) {
throw new RuntimeException(sprintf('Failed to encrypt S/Mime message. Error: "%s".', openssl_error_string()));
throw new RuntimeException(\sprintf('Failed to encrypt S/Mime message. Error: "%s".', openssl_error_string()));
}
$mimePart = $this->convertMessageToSMimePart($outputFile, 'application', 'pkcs7-mime');
+1 -1
View File
@@ -57,7 +57,7 @@ final class SMimeSigner extends SMime
$this->iteratorToFile($message->getBody()->toIterable(), $bufferFile);
if (!@openssl_pkcs7_sign(stream_get_meta_data($bufferFile)['uri'], stream_get_meta_data($outputFile)['uri'], $this->signCertificate, $this->signPrivateKey, [], $this->signOptions, $this->extraCerts)) {
throw new RuntimeException(sprintf('Failed to sign S/Mime message. Error: "%s".', openssl_error_string()));
throw new RuntimeException(\sprintf('Failed to sign S/Mime message. Error: "%s".', openssl_error_string()));
}
return new Message($message->getHeaders(), $this->convertMessageToSMimePart($outputFile, 'multipart', 'signed'));
+3 -3
View File
@@ -246,7 +246,7 @@ class Email extends Message
$priority = 1;
}
return $this->setHeaderBody('Text', 'X-Priority', sprintf('%d (%s)', $priority, self::PRIORITY_MAP[$priority]));
return $this->setHeaderBody('Text', 'X-Priority', \sprintf('%d (%s)', $priority, self::PRIORITY_MAP[$priority]));
}
/**
@@ -270,7 +270,7 @@ class Email extends Message
public function text($body, string $charset = 'utf-8'): static
{
if (null !== $body && !\is_string($body) && !\is_resource($body)) {
throw new \TypeError(sprintf('The body must be a string, a resource or null (got "%s").', get_debug_type($body)));
throw new \TypeError(\sprintf('The body must be a string, a resource or null (got "%s").', get_debug_type($body)));
}
$this->cachedBody = null;
@@ -301,7 +301,7 @@ class Email extends Message
public function html($body, string $charset = 'utf-8'): static
{
if (null !== $body && !\is_string($body) && !\is_resource($body)) {
throw new \TypeError(sprintf('The body must be a string, a resource or null (got "%s").', get_debug_type($body)));
throw new \TypeError(\sprintf('The body must be a string, a resource or null (got "%s").', get_debug_type($body)));
}
$this->cachedBody = null;
+1 -1
View File
@@ -21,7 +21,7 @@ final class Base64ContentEncoder extends Base64Encoder implements ContentEncoder
public function encodeByteStream($stream, int $maxLineLength = 0): iterable
{
if (!\is_resource($stream)) {
throw new \TypeError(sprintf('Method "%s" takes a stream as a first argument.', __METHOD__));
throw new \TypeError(\sprintf('Method "%s" takes a stream as a first argument.', __METHOD__));
}
$filter = stream_filter_append($stream, 'convert.base64-encode', \STREAM_FILTER_READ, [
+1 -1
View File
@@ -35,7 +35,7 @@ final class IdnAddressEncoder implements AddressEncoderInterface
$domain = substr($address, $i + 1);
if (preg_match('/[^\x00-\x7F]/', $domain)) {
$address = sprintf('%s@%s', $local, idn_to_ascii($domain, \IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI | \IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46));
$address = \sprintf('%s@%s', $local, idn_to_ascii($domain, \IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI | \IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII, \INTL_IDNA_VARIANT_UTS46));
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ final class QpContentEncoder implements ContentEncoderInterface
public function encodeByteStream($stream, int $maxLineLength = 0): iterable
{
if (!\is_resource($stream)) {
throw new \TypeError(sprintf('Method "%s" takes a stream as a first argument.', __METHOD__));
throw new \TypeError(\sprintf('Method "%s" takes a stream as a first argument.', __METHOD__));
}
// we don't use PHP stream filters here as the content should be small enough
+3 -3
View File
@@ -56,17 +56,17 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
public function guessMimeType(string $path): ?string
{
if (!is_file($path) || !is_readable($path)) {
throw new InvalidArgumentException(sprintf('The "%s" file does not exist or is not readable.', $path));
throw new InvalidArgumentException(\sprintf('The "%s" file does not exist or is not readable.', $path));
}
if (!$this->isGuesserSupported()) {
throw new LogicException(sprintf('The "%s" guesser is not supported.', __CLASS__));
throw new LogicException(\sprintf('The "%s" guesser is not supported.', __CLASS__));
}
ob_start();
// need to use --mime instead of -i. see #6641
passthru(sprintf($this->cmd, escapeshellarg((str_starts_with($path, '-') ? './' : '').$path)), $return);
passthru(\sprintf($this->cmd, escapeshellarg((str_starts_with($path, '-') ? './' : '').$path)), $return);
if ($return > 0) {
ob_end_clean();
+13 -5
View File
@@ -13,6 +13,7 @@ namespace Symfony\Component\Mime;
use Symfony\Component\Mime\Exception\InvalidArgumentException;
use Symfony\Component\Mime\Exception\LogicException;
use Symfony\Component\Mime\Exception\RuntimeException;
/**
* Guesses the MIME type using the PECL extension FileInfo.
@@ -21,6 +22,11 @@ use Symfony\Component\Mime\Exception\LogicException;
*/
class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface
{
/**
* @var array<string, \finfo>
*/
private static $finfoCache = [];
/**
* @param string|null $magicFile A magic file to use with the finfo instance
*
@@ -39,17 +45,19 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface
public function guessMimeType(string $path): ?string
{
if (!is_file($path) || !is_readable($path)) {
throw new InvalidArgumentException(sprintf('The "%s" file does not exist or is not readable.', $path));
throw new InvalidArgumentException(\sprintf('The "%s" file does not exist or is not readable.', $path));
}
if (!$this->isGuesserSupported()) {
throw new LogicException(sprintf('The "%s" guesser is not supported.', __CLASS__));
throw new LogicException(\sprintf('The "%s" guesser is not supported.', __CLASS__));
}
if (false === $finfo = new \finfo(\FILEINFO_MIME_TYPE, $this->magicFile)) {
return null;
try {
$finfo = self::$finfoCache[$this->magicFile] ??= new \finfo(\FILEINFO_MIME_TYPE, $this->magicFile);
} catch (\Exception $e) {
throw new RuntimeException($e->getMessage());
}
$mimeType = $finfo->file($path);
$mimeType = $finfo->file($path) ?: null;
if ($mimeType && 0 === (\strlen($mimeType) % 2)) {
$mimeStart = substr($mimeType, 0, \strlen($mimeType) >> 1);
+5 -5
View File
@@ -170,7 +170,7 @@ final class Headers
$name = strtolower($header->getName());
if (\in_array($name, self::UNIQUE_HEADERS, true) && isset($this->headers[$name]) && \count($this->headers[$name]) > 0) {
throw new LogicException(sprintf('Impossible to set header "%s" as it\'s already defined and must be unique.', $header->getName()));
throw new LogicException(\sprintf('Impossible to set header "%s" as it\'s already defined and must be unique.', $header->getName()));
}
$this->headers[$name][] = $header;
@@ -241,7 +241,7 @@ final class Headers
}
}
throw new LogicException(sprintf('The "%s" header must be an instance of "%s" (got "%s").', $header->getName(), implode('" or "', $headerClasses), get_debug_type($header)));
throw new LogicException(\sprintf('The "%s" header must be an instance of "%s" (got "%s").', $header->getName(), implode('" or "', $headerClasses), get_debug_type($header)));
}
public function toString(): string
@@ -291,7 +291,7 @@ final class Headers
$header = $this->get($name);
if (!$header instanceof ParameterizedHeader) {
throw new LogicException(sprintf('Unable to get parameter "%s" on header "%s" as the header is not of class "%s".', $parameter, $name, ParameterizedHeader::class));
throw new LogicException(\sprintf('Unable to get parameter "%s" on header "%s" as the header is not of class "%s".', $parameter, $name, ParameterizedHeader::class));
}
return $header->getParameter($parameter);
@@ -303,12 +303,12 @@ final class Headers
public function setHeaderParameter(string $name, string $parameter, ?string $value): void
{
if (!$this->has($name)) {
throw new LogicException(sprintf('Unable to set parameter "%s" on header "%s" as the header is not defined.', $parameter, $name));
throw new LogicException(\sprintf('Unable to set parameter "%s" on header "%s" as the header is not defined.', $parameter, $name));
}
$header = $this->get($name);
if (!$header instanceof ParameterizedHeader) {
throw new LogicException(sprintf('Unable to set parameter "%s" on header "%s" as the header is not of class "%s".', $parameter, $name, ParameterizedHeader::class));
throw new LogicException(\sprintf('Unable to set parameter "%s" on header "%s" as the header is not of class "%s".', $parameter, $name, ParameterizedHeader::class));
}
$header->setParameter($parameter, $value);
+2 -2
View File
@@ -162,9 +162,9 @@ final class ParameterizedHeader extends UnstructuredHeader
}
return implode(";\r\n ", $paramLines);
} else {
return $name.$this->getEndOfParameterValue($valueLines[0], $encoded, true);
}
return $name.$this->getEndOfParameterValue($valueLines[0], $encoded, true);
}
/**
+6 -6
View File
@@ -55,13 +55,13 @@ final class MessageConverter
} elseif ($parts[0] instanceof TextPart) {
$email = self::createEmailFromTextPart($message, $parts[0]);
} else {
throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
throw new RuntimeException(\sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
}
return self::addParts($email, \array_slice($parts, 1));
}
throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
throw new RuntimeException(\sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
}
private static function createEmailFromTextPart(Message $message, TextPart $part): Email
@@ -73,7 +73,7 @@ final class MessageConverter
return (new Email(clone $message->getHeaders()))->html($part->getBody(), $part->getPreparedHeaders()->getHeaderParameter('Content-Type', 'charset') ?: 'utf-8');
}
throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
throw new RuntimeException(\sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
}
private static function createEmailFromAlternativePart(Message $message, AlternativePart $part): Email
@@ -90,7 +90,7 @@ final class MessageConverter
;
}
throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
throw new RuntimeException(\sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
}
private static function createEmailFromRelatedPart(Message $message, RelatedPart $part): Email
@@ -101,7 +101,7 @@ final class MessageConverter
} elseif ($parts[0] instanceof TextPart) {
$email = self::createEmailFromTextPart($message, $parts[0]);
} else {
throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
throw new RuntimeException(\sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($message)));
}
return self::addParts($email, \array_slice($parts, 1));
@@ -111,7 +111,7 @@ final class MessageConverter
{
foreach ($parts as $part) {
if (!$part instanceof DataPart) {
throw new RuntimeException(sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($email)));
throw new RuntimeException(\sprintf('Unable to create an Email from an instance of "%s" as the body is too complex.', get_debug_type($email)));
}
$email->addPart($part);
+136 -50
View File
@@ -135,7 +135,7 @@ final class MimeTypes implements MimeTypesInterface
/**
* A map of MIME types and their default extensions.
*
* Updated from upstream on 2024-03-17.
* Updated from upstream on 2024-11-09.
*
* @see Resources/bin/update_mime_types.php
*/
@@ -154,6 +154,8 @@ final class MimeTypes implements MimeTypesInterface
'application/atsc-dwd+xml' => ['dwd'],
'application/atsc-held+xml' => ['held'],
'application/atsc-rsat+xml' => ['rsat'],
'application/automationml-aml+xml' => ['aml'],
'application/automationml-amlx+zip' => ['amlx'],
'application/bat' => ['bat'],
'application/bdoc' => ['bdoc'],
'application/bzip2' => ['bz2', 'bz'],
@@ -171,6 +173,7 @@ final class MimeTypes implements MimeTypesInterface
'application/cpl+xml' => ['cpl'],
'application/csv' => ['csv'],
'application/cu-seeme' => ['cu'],
'application/cwl' => ['cwl'],
'application/dash+xml' => ['mpd'],
'application/dash-patch+xml' => ['mpp'],
'application/davmount+xml' => ['davmount'],
@@ -187,6 +190,7 @@ final class MimeTypes implements MimeTypesInterface
'application/epub+zip' => ['epub'],
'application/exi' => ['exi'],
'application/express' => ['exp'],
'application/fdf' => ['fdf'],
'application/fdt+xml' => ['fdt'],
'application/fits' => ['fits', 'fit', 'fts'],
'application/font-tdpfr' => ['pfr'],
@@ -203,7 +207,7 @@ final class MimeTypes implements MimeTypesInterface
'application/hta' => ['hta'],
'application/hyperstudio' => ['stk'],
'application/ico' => ['ico'],
'application/ics' => ['vcs', 'ics'],
'application/ics' => ['vcs', 'ics', 'ifb', 'icalendar'],
'application/illustrator' => ['ai'],
'application/inkml+xml' => ['ink', 'inkml'],
'application/ipfix' => ['ipfix'],
@@ -213,7 +217,7 @@ final class MimeTypes implements MimeTypesInterface
'application/java-byte-code' => ['class'],
'application/java-serialized-object' => ['ser'],
'application/java-vm' => ['class'],
'application/javascript' => ['js', 'mjs', 'jsm'],
'application/javascript' => ['js', 'jsm', 'mjs'],
'application/jrd+json' => ['jrd'],
'application/json' => ['json', 'map'],
'application/json-patch+json' => ['json-patch'],
@@ -245,7 +249,7 @@ final class MimeTypes implements MimeTypesInterface
'application/mmt-usd+xml' => ['musd'],
'application/mods+xml' => ['mods'],
'application/mp21' => ['m21', 'mp21'],
'application/mp4' => ['mp4s', 'm4p'],
'application/mp4' => ['mp4', 'mpg4', 'mp4s', 'm4p'],
'application/mrb-consumer+xml' => ['xdf'],
'application/mrb-publish+xml' => ['xdf'],
'application/ms-tnef' => ['tnef', 'tnf'],
@@ -277,7 +281,7 @@ final class MimeTypes implements MimeTypesInterface
'application/pgp' => ['pgp', 'gpg', 'asc'],
'application/pgp-encrypted' => ['pgp', 'gpg', 'asc'],
'application/pgp-keys' => ['asc', 'skr', 'pkr', 'pgp', 'gpg', 'key'],
'application/pgp-signature' => ['asc', 'sig', 'pgp', 'gpg'],
'application/pgp-signature' => ['sig', 'asc', 'pgp', 'gpg'],
'application/photoshop' => ['psd'],
'application/pics-rules' => ['prf'],
'application/pkcs10' => ['p10'],
@@ -298,6 +302,7 @@ final class MimeTypes implements MimeTypesInterface
'application/provenance+xml' => ['provx'],
'application/prs.cww' => ['cww'],
'application/prs.wavefront-obj' => ['obj'],
'application/prs.xsf+xml' => ['xsf'],
'application/pskc+xml' => ['pskcxml'],
'application/ram' => ['ram'],
'application/raml+yaml' => ['raml'],
@@ -380,6 +385,7 @@ final class MimeTypes implements MimeTypesInterface
'application/vnd.anser-web-certificate-issue-initiation' => ['cii'],
'application/vnd.anser-web-funds-transfer-initiation' => ['fti'],
'application/vnd.antix.game-component' => ['atx'],
'application/vnd.apache.parquet' => ['parquet'],
'application/vnd.appimage' => ['appimage'],
'application/vnd.apple.installer+xml' => ['mpkg'],
'application/vnd.apple.keynote' => ['key', 'keynote'],
@@ -476,6 +482,7 @@ final class MimeTypes implements MimeTypesInterface
'application/vnd.genomatix.tuxedo' => ['txd'],
'application/vnd.geo+json' => ['geojson', 'geo.json'],
'application/vnd.geogebra.file' => ['ggb'],
'application/vnd.geogebra.slides' => ['ggs'],
'application/vnd.geogebra.tool' => ['ggt'],
'application/vnd.geometry-explorer' => ['gex', 'gre'],
'application/vnd.geonext' => ['gxt'],
@@ -488,6 +495,7 @@ final class MimeTypes implements MimeTypesInterface
'application/vnd.google-apps.spreadsheet' => ['gsheet'],
'application/vnd.google-earth.kml+xml' => ['kml'],
'application/vnd.google-earth.kmz' => ['kmz'],
'application/vnd.gov.sk.xmldatacontainer+xml' => ['xdcf'],
'application/vnd.grafeq' => ['gqf', 'gqs'],
'application/vnd.groove-account' => ['gac'],
'application/vnd.groove-help' => ['ghf'],
@@ -619,6 +627,7 @@ final class MimeTypes implements MimeTypesInterface
'application/vnd.musician' => ['mus'],
'application/vnd.muvee.style' => ['msty'],
'application/vnd.mynfc' => ['taglet'],
'application/vnd.nato.bindingdataobject+xml' => ['bdo'],
'application/vnd.neurolanguage.nlu' => ['nlu'],
'application/vnd.nintendo.snes.rom' => ['sfc', 'smc'],
'application/vnd.nitf' => ['ntf', 'nitf'],
@@ -634,6 +643,7 @@ final class MimeTypes implements MimeTypesInterface
'application/vnd.novadigm.edx' => ['edx'],
'application/vnd.novadigm.ext' => ['ext'],
'application/vnd.oasis.docbook+xml' => ['dbk', 'docbook'],
'application/vnd.oasis.opendocument.base' => ['odb'],
'application/vnd.oasis.opendocument.chart' => ['odc'],
'application/vnd.oasis.opendocument.chart-template' => ['otc'],
'application/vnd.oasis.opendocument.database' => ['odb'],
@@ -653,6 +663,7 @@ final class MimeTypes implements MimeTypesInterface
'application/vnd.oasis.opendocument.text' => ['odt'],
'application/vnd.oasis.opendocument.text-flat-xml' => ['fodt'],
'application/vnd.oasis.opendocument.text-master' => ['odm'],
'application/vnd.oasis.opendocument.text-master-template' => ['otm'],
'application/vnd.oasis.opendocument.text-template' => ['ott'],
'application/vnd.oasis.opendocument.text-web' => ['oth'],
'application/vnd.olpc-sugar' => ['xo'],
@@ -683,7 +694,8 @@ final class MimeTypes implements MimeTypesInterface
'application/vnd.proteus.magazine' => ['mgz'],
'application/vnd.publishare-delta-tree' => ['qps'],
'application/vnd.pvi.ptid1' => ['ptid'],
'application/vnd.quark.quarkxpress' => ['qxd', 'qxt', 'qwd', 'qwt', 'qxl', 'qxb'],
'application/vnd.pwg-xhtml-print+xml' => ['xhtm'],
'application/vnd.quark.quarkxpress' => ['qxd', 'qxt', 'qwd', 'qwt', 'qxl', 'qxb', 'qxp'],
'application/vnd.rar' => ['rar'],
'application/vnd.realvnc.bed' => ['bed'],
'application/vnd.recordare.musicxml' => ['mxl'],
@@ -712,15 +724,16 @@ final class MimeTypes implements MimeTypesInterface
'application/vnd.spotfire.dxp' => ['dxp'],
'application/vnd.spotfire.sfs' => ['sfs'],
'application/vnd.sqlite3' => ['sqlite3'],
'application/vnd.squashfs' => ['sqsh'],
'application/vnd.squashfs' => ['sfs', 'sqfs', 'sqsh', 'squashfs'],
'application/vnd.stardivision.calc' => ['sdc'],
'application/vnd.stardivision.chart' => ['sds'],
'application/vnd.stardivision.draw' => ['sda'],
'application/vnd.stardivision.impress' => ['sdd', 'sdp'],
'application/vnd.stardivision.mail' => ['smd'],
'application/vnd.stardivision.impress' => ['sdd'],
'application/vnd.stardivision.impress-packed' => ['sdp'],
'application/vnd.stardivision.mail' => ['sdm'],
'application/vnd.stardivision.math' => ['smf'],
'application/vnd.stardivision.writer' => ['sdw', 'vor', 'sgl'],
'application/vnd.stardivision.writer-global' => ['sgl', 'sdw', 'vor'],
'application/vnd.stardivision.writer' => ['sdw', 'vor'],
'application/vnd.stardivision.writer-global' => ['sgl'],
'application/vnd.stepmania.package' => ['smzip'],
'application/vnd.stepmania.stepchart' => ['sm'],
'application/vnd.sun.wadl+xml' => ['wadl'],
@@ -753,7 +766,7 @@ final class MimeTypes implements MimeTypesInterface
'application/vnd.uiq.theme' => ['utz'],
'application/vnd.umajin' => ['umj'],
'application/vnd.unity' => ['unityweb'],
'application/vnd.uoml+xml' => ['uoml'],
'application/vnd.uoml+xml' => ['uoml', 'uo'],
'application/vnd.vcx' => ['vcx'],
'application/vnd.visio' => ['vsd', 'vst', 'vss', 'vsw'],
'application/vnd.visionary' => ['vis'],
@@ -806,7 +819,7 @@ final class MimeTypes implements MimeTypesInterface
'application/x-appleworks-document' => ['cwk'],
'application/x-applix-spreadsheet' => ['as'],
'application/x-applix-word' => ['aw'],
'application/x-archive' => ['a', 'ar'],
'application/x-archive' => ['a', 'ar', 'lib'],
'application/x-arj' => ['arj'],
'application/x-asar' => ['asar'],
'application/x-asp' => ['asp'],
@@ -821,7 +834,7 @@ final class MimeTypes implements MimeTypesInterface
'application/x-bcpio' => ['bcpio'],
'application/x-bdoc' => ['bdoc'],
'application/x-bittorrent' => ['torrent'],
'application/x-blender' => ['blend', 'BLEND', 'blender'],
'application/x-blender' => ['blend', 'blender'],
'application/x-blorb' => ['blb', 'blorb'],
'application/x-bps-patch' => ['bps'],
'application/x-bsdiff' => ['bsdiff'],
@@ -925,7 +938,7 @@ final class MimeTypes implements MimeTypesInterface
'application/x-gdscript' => ['gd'],
'application/x-gedcom' => ['ged', 'gedcom'],
'application/x-genesis-32x-rom' => ['32x', 'mdx'],
'application/x-genesis-rom' => ['gen', 'smd', 'sgd'],
'application/x-genesis-rom' => ['gen', 'smd', 'md', 'sgd'],
'application/x-gerber' => ['gbr'],
'application/x-gerber-job' => ['gbrjob'],
'application/x-gettext' => ['po'],
@@ -1068,8 +1081,10 @@ final class MimeTypes implements MimeTypesInterface
'application/x-nintendo-3ds-executable' => ['3dsx'],
'application/x-nintendo-3ds-rom' => ['3ds', 'cci'],
'application/x-nintendo-ds-rom' => ['nds'],
'application/x-nintendo-switch-xci' => ['xci'],
'application/x-ns-proxy-autoconfig' => ['pac'],
'application/x-nuscript' => ['nu'],
'application/x-nx-xci' => ['xci'],
'application/x-nzb' => ['nzb'],
'application/x-object' => ['o', 'mod'],
'application/x-ogg' => ['ogx'],
@@ -1080,9 +1095,11 @@ final class MimeTypes implements MimeTypesInterface
'application/x-pak' => ['pak'],
'application/x-palm-database' => ['prc', 'pdb', 'pqa', 'oprc'],
'application/x-par2' => ['PAR2', 'par2'],
'application/x-parquet' => ['parquet'],
'application/x-partial-download' => ['wkdownload', 'crdownload', 'part'],
'application/x-pc-engine-rom' => ['pce'],
'application/x-pcap' => ['pcap', 'cap', 'dmp'],
'application/x-pcapng' => ['pcapng', 'ntar'],
'application/x-pdf' => ['pdf'],
'application/x-perl' => ['pl', 'pm', 'PL', 'al', 'perl', 'pod', 't'],
'application/x-photoshop' => ['psd'],
@@ -1098,6 +1115,7 @@ final class MimeTypes implements MimeTypesInterface
'application/x-pyspread-bz-spreadsheet' => ['pys'],
'application/x-pyspread-spreadsheet' => ['pysu'],
'application/x-python-bytecode' => ['pyc', 'pyo'],
'application/x-qbrew' => ['qbrew'],
'application/x-qed-disk' => ['qed'],
'application/x-qemu-disk' => ['qcow2', 'qcow'],
'application/x-qpress' => ['qp'],
@@ -1141,6 +1159,7 @@ final class MimeTypes implements MimeTypesInterface
'application/x-smaf' => ['mmf', 'smaf'],
'application/x-sms-rom' => ['sms'],
'application/x-snes-rom' => ['sfc', 'smc'],
'application/x-sony-bbeb' => ['lrf'],
'application/x-source-rpm' => ['src.rpm', 'spm'],
'application/x-spss-por' => ['por'],
'application/x-spss-sav' => ['sav', 'zsav'],
@@ -1149,11 +1168,20 @@ final class MimeTypes implements MimeTypesInterface
'application/x-sqlite2' => ['sqlite2'],
'application/x-sqlite3' => ['sqlite3'],
'application/x-srt' => ['srt'],
'application/x-starcalc' => ['sdc'],
'application/x-starchart' => ['sds'],
'application/x-stardraw' => ['sda'],
'application/x-starimpress' => ['sdd'],
'application/x-starmail' => ['smd'],
'application/x-starmath' => ['smf'],
'application/x-starwriter' => ['sdw', 'vor'],
'application/x-starwriter-global' => ['sgl'],
'application/x-stuffit' => ['sit'],
'application/x-stuffitx' => ['sitx'],
'application/x-subrip' => ['srt'],
'application/x-sv4cpio' => ['sv4cpio'],
'application/x-sv4crc' => ['sv4crc'],
'application/x-sylk' => ['sylk', 'slk'],
'application/x-t3vm-image' => ['t3'],
'application/x-t602' => ['602'],
'application/x-tads' => ['gam'],
@@ -1238,6 +1266,7 @@ final class MimeTypes implements MimeTypesInterface
'application/xcap-error+xml' => ['xer'],
'application/xcap-ns+xml' => ['xns'],
'application/xenc+xml' => ['xenc'],
'application/xfdf' => ['xfdf'],
'application/xhtml+xml' => ['xhtml', 'xht', 'html', 'htm'],
'application/xliff+xml' => ['xlf', 'xliff'],
'application/xml' => ['xml', 'xsl', 'xsd', 'rng', 'xbl'],
@@ -1407,6 +1436,7 @@ final class MimeTypes implements MimeTypesInterface
'image/cdr' => ['cdr'],
'image/cgm' => ['cgm'],
'image/dicom-rle' => ['drle'],
'image/dpx' => ['dpx'],
'image/emf' => ['emf'],
'image/fax-g3' => ['g3'],
'image/fits' => ['fits', 'fit', 'fts'],
@@ -1445,7 +1475,7 @@ final class MimeTypes implements MimeTypesInterface
'image/photoshop' => ['psd'],
'image/pjpeg' => ['jpg', 'jpeg', 'jpe', 'jfif'],
'image/png' => ['png'],
'image/prs.btif' => ['btif'],
'image/prs.btif' => ['btif', 'btf'],
'image/prs.pti' => ['pti'],
'image/psd' => ['psd'],
'image/qoi' => ['qoi'],
@@ -1505,6 +1535,7 @@ final class MimeTypes implements MimeTypesInterface
'image/x-eps' => ['eps', 'epsi', 'epsf'],
'image/x-exr' => ['exr'],
'image/x-fits' => ['fits', 'fit', 'fts'],
'image/x-fpx' => ['fpx'],
'image/x-freehand' => ['fh', 'fhc', 'fh4', 'fh5', 'fh7'],
'image/x-fuji-raf' => ['raf'],
'image/x-gimp-gbr' => ['gbr'],
@@ -1520,6 +1551,7 @@ final class MimeTypes implements MimeTypesInterface
'image/x-jng' => ['jng'],
'image/x-jp2-codestream' => ['j2c', 'j2k', 'jpc'],
'image/x-jpeg2000-image' => ['jp2', 'jpg2'],
'image/x-kiss-cel' => ['cel', 'kcf'],
'image/x-kodak-dcr' => ['dcr'],
'image/x-kodak-k25' => ['k25'],
'image/x-kodak-kdc' => ['kdc'],
@@ -1539,6 +1571,7 @@ final class MimeTypes implements MimeTypesInterface
'image/x-panasonic-rw2' => ['rw2'],
'image/x-pcx' => ['pcx'],
'image/x-pentax-pef' => ['pef'],
'image/x-pfm' => ['pfm'],
'image/x-photo-cd' => ['pcd'],
'image/x-photoshop' => ['psd'],
'image/x-pict' => ['pic', 'pct', 'pict', 'pict1', 'pict2'],
@@ -1547,8 +1580,10 @@ final class MimeTypes implements MimeTypesInterface
'image/x-portable-graymap' => ['pgm'],
'image/x-portable-pixmap' => ['ppm'],
'image/x-psd' => ['psd'],
'image/x-pxr' => ['pxr'],
'image/x-quicktime' => ['qtif', 'qif'],
'image/x-rgb' => ['rgb'],
'image/x-sct' => ['sct'],
'image/x-sgi' => ['sgi'],
'image/x-sigma-x3f' => ['x3f'],
'image/x-skencil' => ['sk', 'sk1'],
@@ -1579,13 +1614,19 @@ final class MimeTypes implements MimeTypesInterface
'model/gltf+json' => ['gltf'],
'model/gltf-binary' => ['glb'],
'model/iges' => ['igs', 'iges'],
'model/jt' => ['jt'],
'model/mesh' => ['msh', 'mesh', 'silo'],
'model/mtl' => ['mtl'],
'model/obj' => ['obj'],
'model/prc' => ['prc'],
'model/step' => ['step', 'stp'],
'model/step+xml' => ['stpx'],
'model/step+zip' => ['stpz'],
'model/step-xml+zip' => ['stpxz'],
'model/stl' => ['stl'],
'model/u3d' => ['u3d'],
'model/vnd.bary' => ['bary'],
'model/vnd.cld' => ['cld'],
'model/vnd.collada+xml' => ['dae'],
'model/vnd.dwf' => ['dwf'],
'model/vnd.gdl' => ['gdl'],
@@ -1594,7 +1635,9 @@ final class MimeTypes implements MimeTypesInterface
'model/vnd.opengex' => ['ogex'],
'model/vnd.parasolid.transmit.binary' => ['x_b'],
'model/vnd.parasolid.transmit.text' => ['x_t'],
'model/vnd.pytha.pyox' => ['pyo', 'pyox'],
'model/vnd.sap.vds' => ['vds'],
'model/vnd.usda' => ['usda'],
'model/vnd.usdz+zip' => ['usdz'],
'model/vnd.valve.source.compiled-map' => ['bsp'],
'model/vnd.vtu' => ['vtu'],
@@ -1607,7 +1650,7 @@ final class MimeTypes implements MimeTypesInterface
'model/x3d+xml' => ['x3d', 'x3dz'],
'model/x3d-vrml' => ['x3dv'],
'text/cache-manifest' => ['appcache', 'manifest'],
'text/calendar' => ['ics', 'ifb', 'vcs'],
'text/calendar' => ['ics', 'ifb', 'vcs', 'icalendar'],
'text/coffeescript' => ['coffee', 'litcoffee'],
'text/crystal' => ['cr'],
'text/css' => ['css'],
@@ -1620,7 +1663,7 @@ final class MimeTypes implements MimeTypesInterface
'text/html' => ['html', 'htm', 'shtml'],
'text/ico' => ['ico'],
'text/jade' => ['jade'],
'text/javascript' => ['js', 'jsm', 'mjs'],
'text/javascript' => ['js', 'mjs', 'jsm'],
'text/jscript' => ['js', 'jsm', 'mjs'],
'text/jscript.encode' => ['jse'],
'text/jsx' => ['jsx'],
@@ -1672,6 +1715,7 @@ final class MimeTypes implements MimeTypesInterface
'text/vnd.wap.wml' => ['wml'],
'text/vnd.wap.wmlscript' => ['wmls'],
'text/vtt' => ['vtt'],
'text/wgsl' => ['wgsl'],
'text/x-adasrc' => ['adb', 'ads'],
'text/x-asm' => ['s', 'asm'],
'text/x-basic' => ['bas'],
@@ -1690,6 +1734,7 @@ final class MimeTypes implements MimeTypesInterface
'text/x-csharp' => ['cs'],
'text/x-csrc' => ['c'],
'text/x-csv' => ['csv'],
'text/x-cython' => ['pxd', 'pxi', 'pyx'],
'text/x-dart' => ['dart'],
'text/x-dbus-service' => ['service'],
'text/x-dcl' => ['dcl'],
@@ -1744,6 +1789,7 @@ final class MimeTypes implements MimeTypesInterface
'text/x-nfo' => ['nfo'],
'text/x-nim' => ['nim'],
'text/x-nimscript' => ['nims', 'nimble'],
'text/x-nix' => ['nix'],
'text/x-nu' => ['nu'],
'text/x-objc++src' => ['mm'],
'text/x-objcsrc' => ['m'],
@@ -1761,8 +1807,9 @@ final class MimeTypes implements MimeTypesInterface
'text/x-po' => ['po'],
'text/x-pot' => ['pot'],
'text/x-processing' => ['pde'],
'text/x-python' => ['py', 'pyx', 'wsgi'],
'text/x-python3' => ['py', 'py3', 'py3x', 'pyi'],
'text/x-python' => ['py', 'wsgi'],
'text/x-python2' => ['py', 'py2'],
'text/x-python3' => ['py', 'py3', 'pyi'],
'text/x-qml' => ['qml', 'qmltypes', 'qmlproject'],
'text/x-reject' => ['rej'],
'text/x-rpm-spec' => ['spec'],
@@ -1796,7 +1843,7 @@ final class MimeTypes implements MimeTypesInterface
'text/x-uuencode' => ['uu', 'uue'],
'text/x-vala' => ['vala', 'vapi'],
'text/x-vb' => ['vb'],
'text/x-vcalendar' => ['vcs', 'ics'],
'text/x-vcalendar' => ['vcs', 'ics', 'ifb', 'icalendar'],
'text/x-vcard' => ['vcf', 'vcard', 'vct', 'gcrd'],
'text/x-verilog' => ['v'],
'text/x-vhdl' => ['vhd', 'vhdl'],
@@ -1829,6 +1876,7 @@ final class MimeTypes implements MimeTypesInterface
'video/mp4v-es' => ['mp4', 'm4v', 'f4v', 'lrv'],
'video/mpeg' => ['mpeg', 'mpg', 'mpe', 'm1v', 'm2v', 'mp2', 'vob'],
'video/mpeg-system' => ['mpeg', 'mpg', 'mp2', 'mpe', 'vob'],
'video/mpg4' => ['mpg4'],
'video/msvideo' => ['avi', 'avf', 'divx'],
'video/ogg' => ['ogv', 'ogg'],
'video/quicktime' => ['mov', 'qt', 'moov', 'qtvr'],
@@ -1916,7 +1964,6 @@ final class MimeTypes implements MimeTypesInterface
'669' => ['audio/x-mod'],
'7z' => ['application/x-7z-compressed'],
'7z.001' => ['application/x-7z-compressed'],
'BLEND' => ['application/x-blender'],
'C' => ['text/x-c++src'],
'PAR2' => ['application/x-par2'],
'PL' => ['application/x-perl', 'text/x-perl'],
@@ -1962,6 +2009,8 @@ final class MimeTypes implements MimeTypesInterface
'al' => ['application/x-perl', 'text/x-perl'],
'alz' => ['application/x-alz'],
'ami' => ['application/vnd.amiga.ami'],
'aml' => ['application/automationml-aml+xml'],
'amlx' => ['application/automationml-amlx+zip'],
'amr' => ['audio/amr', 'audio/amr-encrypted'],
'amz' => ['audio/x-amzxml'],
'ani' => ['application/x-navi-animation'],
@@ -2028,12 +2077,14 @@ final class MimeTypes implements MimeTypesInterface
'azw3' => ['application/vnd.amazon.mobi8-ebook', 'application/x-mobi8-ebook'],
'b16' => ['image/vnd.pco.b16'],
'bak' => ['application/x-trash'],
'bary' => ['model/vnd.bary'],
'bas' => ['text/x-basic'],
'bat' => ['application/bat', 'application/x-bat', 'application/x-msdownload'],
'bcpio' => ['application/x-bcpio'],
'bdf' => ['application/x-font-bdf'],
'bdm' => ['application/vnd.syncml.dm+wbxml', 'video/mp2t'],
'bdmv' => ['video/mp2t'],
'bdo' => ['application/vnd.nato.bindingdataobject+xml'],
'bdoc' => ['application/bdoc', 'application/x-bdoc'],
'bed' => ['application/vnd.realvnc.bed'],
'bh2' => ['application/vnd.fujitsu.oasysprs'],
@@ -2056,6 +2107,7 @@ final class MimeTypes implements MimeTypesInterface
'brk' => ['chemical/x-pdb'],
'bsdiff' => ['application/x-bsdiff'],
'bsp' => ['model/vnd.valve.source.compiled-map'],
'btf' => ['image/prs.btif'],
'btif' => ['image/prs.btif'],
'bz' => ['application/bzip2', 'application/x-bzip', 'application/x-bzip1'],
'bz2' => ['application/x-bz2', 'application/bzip2', 'application/x-bzip', 'application/x-bzip2'],
@@ -2101,6 +2153,7 @@ final class MimeTypes implements MimeTypesInterface
'cdx' => ['chemical/x-cdx'],
'cdxml' => ['application/vnd.chemdraw+xml'],
'cdy' => ['application/vnd.cinderella'],
'cel' => ['image/x-kiss-cel'],
'cer' => ['application/pkix-cert'],
'cert' => ['application/x-x509-ca-cert'],
'cfs' => ['application/x-cfs-compressed'],
@@ -2117,6 +2170,7 @@ final class MimeTypes implements MimeTypesInterface
'cl' => ['text/x-opencl-src'],
'cla' => ['application/vnd.claymore'],
'class' => ['application/java', 'application/java-byte-code', 'application/java-vm', 'application/x-java', 'application/x-java-class', 'application/x-java-vm'],
'cld' => ['model/vnd.cld'],
'clkk' => ['application/vnd.crick.clicker.keyboard'],
'clkp' => ['application/vnd.crick.clicker.palette'],
'clkt' => ['application/vnd.crick.clicker.template'],
@@ -2167,6 +2221,7 @@ final class MimeTypes implements MimeTypesInterface
'cur' => ['image/x-win-bitmap'],
'curl' => ['text/vnd.curl'],
'cwk' => ['application/x-appleworks-document'],
'cwl' => ['application/cwl'],
'cww' => ['application/prs.cww'],
'cxt' => ['application/x-director'],
'cxx' => ['text/x-c', 'text/x-c++src'],
@@ -2221,6 +2276,7 @@ final class MimeTypes implements MimeTypesInterface
'dotx' => ['application/vnd.openxmlformats-officedocument.wordprocessingml.template'],
'dp' => ['application/vnd.osgi.dp'],
'dpg' => ['application/vnd.dpgraph'],
'dpx' => ['image/dpx'],
'dra' => ['audio/vnd.dra'],
'drl' => ['application/x-excellon'],
'drle' => ['image/dicom-rle'],
@@ -2315,7 +2371,7 @@ final class MimeTypes implements MimeTypesInterface
'fcdt' => ['application/vnd.adobe.formscentral.fcdt'],
'fcs' => ['application/vnd.isac.fcs'],
'fd' => ['application/x-fd-file', 'application/x-raw-floppy-disk-image'],
'fdf' => ['application/vnd.fdf'],
'fdf' => ['application/fdf', 'application/vnd.fdf'],
'fds' => ['application/x-fds-disk'],
'fdt' => ['application/fdt+xml'],
'fe_launch' => ['application/vnd.denovo.fcselayout-link'],
@@ -2351,7 +2407,7 @@ final class MimeTypes implements MimeTypesInterface
'fods' => ['application/vnd.oasis.opendocument.spreadsheet-flat-xml'],
'fodt' => ['application/vnd.oasis.opendocument.text-flat-xml'],
'for' => ['text/x-fortran'],
'fpx' => ['image/vnd.fpx'],
'fpx' => ['image/vnd.fpx', 'image/x-fpx'],
'frame' => ['application/vnd.framemaker'],
'fsc' => ['application/vnd.fsc.weblaunch'],
'fst' => ['image/vnd.fst'],
@@ -2392,6 +2448,7 @@ final class MimeTypes implements MimeTypesInterface
'gf' => ['application/x-tex-gf'],
'gg' => ['application/x-gamegear-rom'],
'ggb' => ['application/vnd.geogebra.file'],
'ggs' => ['application/vnd.geogebra.slides'],
'ggt' => ['application/vnd.geogebra.tool'],
'ghf' => ['application/vnd.groove-help'],
'gif' => ['image/gif'],
@@ -2488,6 +2545,7 @@ final class MimeTypes implements MimeTypesInterface
'hxx' => ['text/x-c++hdr'],
'i2g' => ['application/vnd.intergeo'],
'ica' => ['application/x-ica'],
'icalendar' => ['application/ics', 'text/calendar', 'text/x-vcalendar'],
'icb' => ['application/tga', 'application/x-targa', 'application/x-tga', 'image/targa', 'image/tga', 'image/x-icb', 'image/x-targa', 'image/x-tga'],
'icc' => ['application/vnd.iccprofile'],
'ice' => ['x-conference/x-cooltalk'],
@@ -2497,7 +2555,7 @@ final class MimeTypes implements MimeTypesInterface
'ics' => ['application/ics', 'text/calendar', 'text/x-vcalendar'],
'idl' => ['text/x-idl'],
'ief' => ['image/ief'],
'ifb' => ['text/calendar'],
'ifb' => ['application/ics', 'text/calendar', 'text/x-vcalendar'],
'iff' => ['image/x-iff', 'image/x-ilbm'],
'ifm' => ['application/vnd.shana.informed.formdata'],
'iges' => ['model/iges'],
@@ -2577,6 +2635,7 @@ final class MimeTypes implements MimeTypesInterface
'jsonld' => ['application/ld+json'],
'jsonml' => ['application/jsonml+json'],
'jsx' => ['text/jsx'],
'jt' => ['model/jt'],
'jxl' => ['image/jxl'],
'jxr' => ['image/jxr', 'image/vnd.ms-photo'],
'jxra' => ['image/jxra'],
@@ -2589,6 +2648,7 @@ final class MimeTypes implements MimeTypesInterface
'k7' => ['application/x-thomson-cassette'],
'kar' => ['audio/midi', 'audio/x-midi'],
'karbon' => ['application/vnd.kde.karbon', 'application/x-karbon'],
'kcf' => ['image/x-kiss-cel'],
'kdbx' => ['application/x-keepass2'],
'kdc' => ['image/x-kodak-kdc'],
'kdelnk' => ['application/x-desktop', 'application/x-gnome-app-info'],
@@ -2637,7 +2697,7 @@ final class MimeTypes implements MimeTypesInterface
'lha' => ['application/x-lha', 'application/x-lzh-compressed'],
'lhs' => ['text/x-literate-haskell'],
'lhz' => ['application/x-lhz'],
'lib' => ['application/vnd.microsoft.portable-executable'],
'lib' => ['application/vnd.microsoft.portable-executable', 'application/x-archive'],
'link66' => ['application/vnd.route66.link66+xml'],
'lisp' => ['text/x-common-lisp'],
'list' => ['text/plain'],
@@ -2650,6 +2710,7 @@ final class MimeTypes implements MimeTypesInterface
'loas' => ['audio/usac'],
'log' => ['text/plain', 'text/x-log'],
'lostxml' => ['application/lost+xml'],
'lrf' => ['application/x-sony-bbeb'],
'lrm' => ['application/vnd.ms-lrm'],
'lrv' => ['video/mp4', 'video/mp4v-es', 'video/x-m4v'],
'lrz' => ['application/x-lrzip'],
@@ -2711,7 +2772,7 @@ final class MimeTypes implements MimeTypesInterface
'mc2' => ['text/vnd.senx.warpscript'],
'mcd' => ['application/vnd.mcd'],
'mcurl' => ['text/vnd.curl.mcurl'],
'md' => ['text/markdown', 'text/x-markdown'],
'md' => ['text/markdown', 'text/x-markdown', 'application/x-genesis-rom'],
'mdb' => ['application/x-msaccess', 'application/mdb', 'application/msaccess', 'application/vnd.ms-access', 'application/vnd.msaccess', 'application/x-lmdb', 'application/x-mdb', 'zz-application/zz-winassoc-mdb'],
'mdi' => ['image/vnd.ms-modi'],
'mdx' => ['application/x-genesis-32x-rom', 'text/mdx'],
@@ -2770,7 +2831,7 @@ final class MimeTypes implements MimeTypesInterface
'mp21' => ['application/mp21'],
'mp2a' => ['audio/mpeg'],
'mp3' => ['audio/mpeg', 'audio/mp3', 'audio/x-mp3', 'audio/x-mpeg', 'audio/x-mpg'],
'mp4' => ['video/mp4', 'video/mp4v-es', 'video/x-m4v'],
'mp4' => ['video/mp4', 'application/mp4', 'video/mp4v-es', 'video/x-m4v'],
'mp4a' => ['audio/mp4'],
'mp4s' => ['application/mp4'],
'mp4v' => ['video/mp4'],
@@ -2780,7 +2841,7 @@ final class MimeTypes implements MimeTypesInterface
'mpeg' => ['video/mpeg', 'video/mpeg-system', 'video/x-mpeg', 'video/x-mpeg-system', 'video/x-mpeg2'],
'mpf' => ['application/media-policy-dataset+xml'],
'mpg' => ['video/mpeg', 'video/mpeg-system', 'video/x-mpeg', 'video/x-mpeg-system', 'video/x-mpeg2'],
'mpg4' => ['video/mp4'],
'mpg4' => ['video/mpg4', 'application/mp4', 'video/mp4'],
'mpga' => ['audio/mp3', 'audio/mpeg', 'audio/x-mp3', 'audio/x-mpeg', 'audio/x-mpg'],
'mpkg' => ['application/vnd.apple.installer+xml'],
'mpl' => ['text/x-mpl2', 'video/mp2t'],
@@ -2848,6 +2909,7 @@ final class MimeTypes implements MimeTypesInterface
'nimble' => ['text/x-nimscript'],
'nims' => ['text/x-nimscript'],
'nitf' => ['application/vnd.nitf'],
'nix' => ['text/x-nix'],
'nlu' => ['application/vnd.neurolanguage.nlu'],
'nml' => ['application/vnd.enliven'],
'nnd' => ['application/vnd.noblenet-directory'],
@@ -2861,6 +2923,7 @@ final class MimeTypes implements MimeTypesInterface
'nsf' => ['application/vnd.lotus-notes'],
'nsv' => ['video/x-nsv'],
'nt' => ['application/n-triples'],
'ntar' => ['application/x-pcapng'],
'ntf' => ['application/vnd.nitf'],
'nu' => ['application/x-nuscript', 'text/x-nu'],
'numbers' => ['application/vnd.apple.numbers', 'application/x-iwork-numbers-sffnumbers'],
@@ -2875,7 +2938,7 @@ final class MimeTypes implements MimeTypesInterface
'ocl' => ['text/x-ocl'],
'ocx' => ['application/vnd.microsoft.portable-executable'],
'oda' => ['application/oda'],
'odb' => ['application/vnd.oasis.opendocument.database', 'application/vnd.sun.xml.base'],
'odb' => ['application/vnd.oasis.opendocument.base', 'application/vnd.oasis.opendocument.database', 'application/vnd.sun.xml.base'],
'odc' => ['application/vnd.oasis.opendocument.chart'],
'odf' => ['application/vnd.oasis.opendocument.formula'],
'odft' => ['application/vnd.oasis.opendocument.formula-template'],
@@ -2915,6 +2978,7 @@ final class MimeTypes implements MimeTypesInterface
'otg' => ['application/vnd.oasis.opendocument.graphics-template'],
'oth' => ['application/vnd.oasis.opendocument.text-web'],
'oti' => ['application/vnd.oasis.opendocument.image-template'],
'otm' => ['application/vnd.oasis.opendocument.text-master-template'],
'otp' => ['application/vnd.oasis.opendocument.presentation-template'],
'ots' => ['application/vnd.oasis.opendocument.spreadsheet-template'],
'ott' => ['application/vnd.oasis.opendocument.text-template'],
@@ -2941,6 +3005,7 @@ final class MimeTypes implements MimeTypesInterface
'pages' => ['application/vnd.apple.pages', 'application/x-iwork-pages-sffpages'],
'pak' => ['application/x-pak'],
'par2' => ['application/x-par2'],
'parquet' => ['application/vnd.apache.parquet', 'application/x-parquet'],
'part' => ['application/x-partial-download'],
'pas' => ['text/x-pascal'],
'pat' => ['image/x-gimp-pat'],
@@ -2950,6 +3015,7 @@ final class MimeTypes implements MimeTypesInterface
'pbd' => ['application/vnd.powerbuilder6'],
'pbm' => ['image/x-portable-bitmap'],
'pcap' => ['application/pcap', 'application/vnd.tcpdump.pcap', 'application/x-pcap'],
'pcapng' => ['application/x-pcapng'],
'pcd' => ['image/x-photo-cd'],
'pce' => ['application/x-pc-engine-rom'],
'pcf' => ['application/x-cisco-vpn-settings', 'application/x-font-pcf'],
@@ -2973,7 +3039,7 @@ final class MimeTypes implements MimeTypesInterface
'perl' => ['application/x-perl', 'text/x-perl'],
'pfa' => ['application/x-font-type1'],
'pfb' => ['application/x-font-type1'],
'pfm' => ['application/x-font-type1'],
'pfm' => ['application/x-font-type1', 'image/x-pfm'],
'pfr' => ['application/font-tdpfr', 'application/vnd.truedoc'],
'pfx' => ['application/pkcs12', 'application/x-pkcs12'],
'pgm' => ['image/x-portable-graymap'],
@@ -3026,7 +3092,7 @@ final class MimeTypes implements MimeTypesInterface
'pptx' => ['application/vnd.openxmlformats-officedocument.presentationml.presentation'],
'ppz' => ['application/mspowerpoint', 'application/powerpoint', 'application/vnd.ms-powerpoint', 'application/x-mspowerpoint'],
'pqa' => ['application/vnd.palm', 'application/x-palm-database'],
'prc' => ['application/vnd.palm', 'application/x-mobipocket-ebook', 'application/x-palm-database', 'application/x-pilot'],
'prc' => ['application/vnd.palm', 'application/x-mobipocket-ebook', 'application/x-palm-database', 'application/x-pilot', 'model/prc'],
'pre' => ['application/vnd.lotus-freelance'],
'prf' => ['application/pics-rules'],
'provx' => ['application/provenance+xml'],
@@ -3048,19 +3114,24 @@ final class MimeTypes implements MimeTypesInterface
'pvb' => ['application/vnd.3gpp.pic-bw-var'],
'pw' => ['application/x-pw'],
'pwn' => ['application/vnd.3m.post-it-notes'],
'py' => ['text/x-python', 'text/x-python3'],
'pxd' => ['text/x-cython'],
'pxi' => ['text/x-cython'],
'pxr' => ['image/x-pxr'],
'py' => ['text/x-python', 'text/x-python2', 'text/x-python3'],
'py2' => ['text/x-python2'],
'py3' => ['text/x-python3'],
'py3x' => ['text/x-python3'],
'pya' => ['audio/vnd.ms-playready.media.pya'],
'pyc' => ['application/x-python-bytecode'],
'pyi' => ['text/x-python3'],
'pyo' => ['application/x-python-bytecode'],
'pyo' => ['application/x-python-bytecode', 'model/vnd.pytha.pyox'],
'pyox' => ['model/vnd.pytha.pyox'],
'pys' => ['application/x-pyspread-bz-spreadsheet'],
'pysu' => ['application/x-pyspread-spreadsheet'],
'pyv' => ['video/vnd.ms-playready.media.pyv'],
'pyx' => ['text/x-python'],
'pyx' => ['text/x-cython'],
'qam' => ['application/vnd.epson.quickanime'],
'qbo' => ['application/vnd.intu.qbo'],
'qbrew' => ['application/x-qbrew'],
'qcow' => ['application/x-qemu-disk'],
'qcow2' => ['application/x-qemu-disk'],
'qd' => ['application/x-fd-file', 'application/x-raw-floppy-disk-image'],
@@ -3086,6 +3157,7 @@ final class MimeTypes implements MimeTypesInterface
'qxb' => ['application/vnd.quark.quarkxpress'],
'qxd' => ['application/vnd.quark.quarkxpress'],
'qxl' => ['application/vnd.quark.quarkxpress'],
'qxp' => ['application/vnd.quark.quarkxpress'],
'qxt' => ['application/vnd.quark.quarkxpress'],
'ra' => ['audio/vnd.m-realaudio', 'audio/vnd.rn-realaudio', 'audio/x-pn-realaudio', 'audio/x-realaudio'],
'raf' => ['image/x-fuji-raf'],
@@ -3170,15 +3242,17 @@ final class MimeTypes implements MimeTypesInterface
'scr' => ['application/vnd.microsoft.portable-executable', 'application/x-ms-dos-executable', 'application/x-ms-ne-executable', 'application/x-msdownload'],
'scs' => ['application/scvp-cv-response'],
'scss' => ['text/x-scss'],
'sct' => ['image/x-sct'],
'scurl' => ['text/vnd.curl.scurl'],
'sda' => ['application/vnd.stardivision.draw'],
'sdc' => ['application/vnd.stardivision.calc'],
'sdd' => ['application/vnd.stardivision.impress'],
'sda' => ['application/vnd.stardivision.draw', 'application/x-stardraw'],
'sdc' => ['application/vnd.stardivision.calc', 'application/x-starcalc'],
'sdd' => ['application/vnd.stardivision.impress', 'application/x-starimpress'],
'sdkd' => ['application/vnd.solent.sdkm+xml'],
'sdkm' => ['application/vnd.solent.sdkm+xml'],
'sdp' => ['application/sdp', 'application/vnd.sdp', 'application/vnd.stardivision.impress', 'application/x-sdp'],
'sds' => ['application/vnd.stardivision.chart'],
'sdw' => ['application/vnd.stardivision.writer', 'application/vnd.stardivision.writer-global'],
'sdm' => ['application/vnd.stardivision.mail'],
'sdp' => ['application/sdp', 'application/vnd.sdp', 'application/vnd.stardivision.impress-packed', 'application/x-sdp'],
'sds' => ['application/vnd.stardivision.chart', 'application/x-starchart'],
'sdw' => ['application/vnd.stardivision.writer', 'application/x-starwriter'],
'sea' => ['application/x-sea'],
'see' => ['application/vnd.seemail'],
'seed' => ['application/vnd.fdsn.seed'],
@@ -3193,14 +3267,14 @@ final class MimeTypes implements MimeTypesInterface
'setreg' => ['application/set-registration-initiation'],
'sfc' => ['application/vnd.nintendo.snes.rom', 'application/x-snes-rom'],
'sfd-hdstx' => ['application/vnd.hydrostatix.sof-data'],
'sfs' => ['application/vnd.spotfire.sfs'],
'sfs' => ['application/vnd.spotfire.sfs', 'application/vnd.squashfs'],
'sfv' => ['text/x-sfv'],
'sg' => ['application/x-sg1000-rom'],
'sgb' => ['application/x-gameboy-rom'],
'sgd' => ['application/x-genesis-rom'],
'sgf' => ['application/x-go-sgf'],
'sgi' => ['image/sgi', 'image/x-sgi'],
'sgl' => ['application/vnd.stardivision.writer', 'application/vnd.stardivision.writer-global'],
'sgl' => ['application/vnd.stardivision.writer-global', 'application/x-starwriter-global'],
'sgm' => ['text/sgml'],
'sgml' => ['text/sgml'],
'sh' => ['application/x-sh', 'application/x-shellscript', 'text/x-sh'],
@@ -3233,15 +3307,15 @@ final class MimeTypes implements MimeTypesInterface
'sldx' => ['application/vnd.openxmlformats-officedocument.presentationml.slide'],
'slice' => ['text/x-systemd-unit'],
'slim' => ['text/slim'],
'slk' => ['text/spreadsheet'],
'slk' => ['application/x-sylk', 'text/spreadsheet'],
'slm' => ['text/slim'],
'sls' => ['application/route-s-tsid+xml'],
'slt' => ['application/vnd.epson.salt'],
'sm' => ['application/vnd.stepmania.stepchart'],
'smaf' => ['application/vnd.smaf', 'application/x-smaf'],
'smc' => ['application/vnd.nintendo.snes.rom', 'application/x-snes-rom'],
'smd' => ['application/vnd.stardivision.mail', 'application/x-genesis-rom'],
'smf' => ['application/vnd.stardivision.math'],
'smd' => ['application/x-genesis-rom', 'application/x-starmail'],
'smf' => ['application/vnd.stardivision.math', 'application/x-starmath'],
'smi' => ['application/smil', 'application/smil+xml', 'application/x-sami'],
'smil' => ['application/smil', 'application/smil+xml'],
'smk' => ['video/vnd.radgamettools.smacker'],
@@ -3265,10 +3339,12 @@ final class MimeTypes implements MimeTypesInterface
'spp' => ['application/scvp-vp-response'],
'spq' => ['application/scvp-vp-request'],
'spx' => ['application/x-apple-systemprofiler+xml', 'audio/ogg', 'audio/x-speex', 'audio/x-speex+ogg'],
'sqfs' => ['application/vnd.squashfs'],
'sql' => ['application/sql', 'application/x-sql', 'text/x-sql'],
'sqlite2' => ['application/x-sqlite2'],
'sqlite3' => ['application/vnd.sqlite3', 'application/x-sqlite3'],
'sqsh' => ['application/vnd.squashfs'],
'squashfs' => ['application/vnd.squashfs'],
'sr2' => ['image/x-sony-sr2'],
'src' => ['application/x-wais-source'],
'src.rpm' => ['application/x-source-rpm'],
@@ -3285,11 +3361,13 @@ final class MimeTypes implements MimeTypesInterface
'st' => ['application/vnd.sailingtracker.track'],
'stc' => ['application/vnd.sun.xml.calc.template'],
'std' => ['application/vnd.sun.xml.draw.template'],
'step' => ['model/step'],
'stf' => ['application/vnd.wt.stf'],
'sti' => ['application/vnd.sun.xml.impress.template'],
'stk' => ['application/hyperstudio'],
'stl' => ['application/vnd.ms-pki.stl', 'model/stl', 'model/x.stl-ascii', 'model/x.stl-binary'],
'stm' => ['audio/x-stm'],
'stp' => ['model/step'],
'stpx' => ['model/step+xml'],
'stpxz' => ['model/step-xml+zip'],
'stpz' => ['model/step+zip'],
@@ -3323,7 +3401,7 @@ final class MimeTypes implements MimeTypesInterface
'sxi' => ['application/vnd.sun.xml.impress'],
'sxm' => ['application/vnd.sun.xml.math'],
'sxw' => ['application/vnd.sun.xml.writer'],
'sylk' => ['text/spreadsheet'],
'sylk' => ['application/x-sylk', 'text/spreadsheet'],
'sys' => ['application/vnd.microsoft.portable-executable'],
't' => ['application/x-perl', 'application/x-troff', 'text/troff', 'text/x-perl', 'text/x-troff'],
't2t' => ['text/x-txt2tags'],
@@ -3415,6 +3493,7 @@ final class MimeTypes implements MimeTypesInterface
'tzo' => ['application/x-tzo'],
'tzst' => ['application/x-zstd-compressed-tar'],
'u32' => ['application/x-authorware-bin'],
'u3d' => ['model/u3d'],
'u8dsn' => ['message/global-delivery-status'],
'u8hdr' => ['message/global-headers'],
'u8mdn' => ['message/global-disposition-notification'],
@@ -3433,11 +3512,13 @@ final class MimeTypes implements MimeTypesInterface
'uni' => ['audio/x-mod'],
'unif' => ['application/x-nes-rom'],
'unityweb' => ['application/vnd.unity'],
'uo' => ['application/vnd.uoml+xml'],
'uoml' => ['application/vnd.uoml+xml'],
'uri' => ['text/uri-list'],
'uris' => ['text/uri-list'],
'url' => ['application/x-mswinurl'],
'urls' => ['text/uri-list'],
'usda' => ['model/vnd.usda'],
'usdz' => ['model/vnd.usdz+zip'],
'ustar' => ['application/x-ustar'],
'utz' => ['application/vnd.uiq.theme'],
@@ -3500,7 +3581,7 @@ final class MimeTypes implements MimeTypesInterface
'vmdk' => ['application/x-virtualbox-vmdk', 'application/x-vmdk-disk'],
'vob' => ['video/mpeg', 'video/mpeg-system', 'video/x-mpeg', 'video/x-mpeg-system', 'video/x-mpeg2', 'video/x-ms-vob'],
'voc' => ['audio/x-voc'],
'vor' => ['application/vnd.stardivision.writer', 'application/vnd.stardivision.writer-global'],
'vor' => ['application/vnd.stardivision.writer', 'application/x-starwriter'],
'vox' => ['application/x-authorware-bin'],
'vpc' => ['application/x-vhd-disk', 'application/x-virtualbox-vhd'],
'vrm' => ['model/vrml'],
@@ -3542,6 +3623,7 @@ final class MimeTypes implements MimeTypesInterface
'webmanifest' => ['application/manifest+json'],
'webp' => ['image/webp'],
'wg' => ['application/vnd.pmi.widget'],
'wgsl' => ['text/wgsl'],
'wgt' => ['application/widget'],
'wif' => ['application/watcherinfo+xml'],
'wim' => ['application/x-ms-wim'],
@@ -3610,7 +3692,9 @@ final class MimeTypes implements MimeTypesInterface
'xcf' => ['image/x-xcf'],
'xcf.bz2' => ['image/x-compressed-xcf'],
'xcf.gz' => ['image/x-compressed-xcf'],
'xci' => ['application/x-nintendo-switch-xci', 'application/x-nx-xci'],
'xcs' => ['application/calendar+xml'],
'xdcf' => ['application/vnd.gov.sk.xmldatacontainer+xml'],
'xdf' => ['application/mrb-consumer+xml', 'application/mrb-publish+xml', 'application/xcap-diff+xml'],
'xdgapp' => ['application/vnd.flatpak', 'application/vnd.xdgapp'],
'xdm' => ['application/vnd.syncml.dm+xml'],
@@ -3620,10 +3704,11 @@ final class MimeTypes implements MimeTypesInterface
'xel' => ['application/xcap-el+xml'],
'xenc' => ['application/xenc+xml'],
'xer' => ['application/patch-ops-error+xml', 'application/xcap-error+xml'],
'xfdf' => ['application/vnd.adobe.xfdf'],
'xfdf' => ['application/vnd.adobe.xfdf', 'application/xfdf'],
'xfdl' => ['application/vnd.xfdl'],
'xhe' => ['audio/usac'],
'xht' => ['application/xhtml+xml'],
'xhtm' => ['application/vnd.pwg-xhtml-print+xml'],
'xhtml' => ['application/xhtml+xml'],
'xhvml' => ['application/xv+xml'],
'xi' => ['audio/x-xi'],
@@ -3660,6 +3745,7 @@ final class MimeTypes implements MimeTypesInterface
'xpw' => ['application/vnd.intercon.formnet'],
'xpx' => ['application/vnd.intercon.formnet'],
'xsd' => ['application/xml', 'text/xml'],
'xsf' => ['application/prs.xsf+xml'],
'xsl' => ['application/xml', 'application/xslt+xml'],
'xslfo' => ['text/x-xslfo'],
'xslt' => ['application/xslt+xml'],
+1 -1
View File
@@ -66,7 +66,7 @@ class DataPart extends TextPart
public function setContentId(string $cid): static
{
if (!str_contains($cid, '@')) {
throw new InvalidArgumentException(sprintf('Invalid cid "%s".', $cid));
throw new InvalidArgumentException(\sprintf('The "%s" CID is invalid as it doesn\'t contain an "@".', $cid));
}
$this->cid = $cid;
+3 -3
View File
@@ -52,14 +52,14 @@ final class FormDataPart extends AbstractMultipartPart
$prepare = function ($item, $key, $root = null) use (&$values, &$prepare) {
if (null === $root && \is_int($key) && \is_array($item)) {
if (1 !== \count($item)) {
throw new InvalidArgumentException(sprintf('Form field values with integer keys can only have one array element, the key being the field name and the value being the field value, %d provided.', \count($item)));
throw new InvalidArgumentException(\sprintf('Form field values with integer keys can only have one array element, the key being the field name and the value being the field value, %d provided.', \count($item)));
}
$key = key($item);
$item = $item[$key];
}
$fieldName = null !== $root ? sprintf('%s[%s]', $root, $key) : $key;
$fieldName = null !== $root ? \sprintf('%s[%s]', $root, $key) : $key;
if (\is_array($item)) {
array_walk($item, $prepare, $fieldName);
@@ -68,7 +68,7 @@ final class FormDataPart extends AbstractMultipartPart
}
if (!\is_string($item) && !$item instanceof TextPart) {
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.', $fieldName, get_debug_type($item)));
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.', $fieldName, get_debug_type($item)));
}
$values[] = $this->preparePart($fieldName, $item);
+21 -6
View File
@@ -23,6 +23,8 @@ use Symfony\Component\Mime\Header\Headers;
*/
class TextPart extends AbstractPart
{
private const DEFAULT_ENCODERS = ['quoted-printable', 'base64', '8bit'];
/** @internal */
protected Headers $_headers;
@@ -45,13 +47,13 @@ class TextPart extends AbstractPart
parent::__construct();
if (!\is_string($body) && !\is_resource($body) && !$body instanceof File) {
throw new \TypeError(sprintf('The body of "%s" must be a string, a resource, or an instance of "%s" (got "%s").', self::class, File::class, get_debug_type($body)));
throw new \TypeError(\sprintf('The body of "%s" must be a string, a resource, or an instance of "%s" (got "%s").', self::class, File::class, get_debug_type($body)));
}
if ($body instanceof File) {
$path = $body->getPath();
if ((is_file($path) && !is_readable($path)) || is_dir($path)) {
throw new InvalidArgumentException(sprintf('Path "%s" is not readable.', $path));
throw new InvalidArgumentException(\sprintf('Path "%s" is not readable.', $path));
}
}
@@ -63,8 +65,8 @@ class TextPart extends AbstractPart
if (null === $encoding) {
$this->encoding = $this->chooseEncoding();
} else {
if ('quoted-printable' !== $encoding && 'base64' !== $encoding && '8bit' !== $encoding) {
throw new InvalidArgumentException(sprintf('The encoding must be one of "quoted-printable", "base64", or "8bit" ("%s" given).', $encoding));
if (!\in_array($encoding, self::DEFAULT_ENCODERS, true) && !\array_key_exists($encoding, self::$encoders)) {
throw new InvalidArgumentException(\sprintf('The encoding must be one of "%s" ("%s" given).', implode('", "', array_unique(array_merge(self::DEFAULT_ENCODERS, array_keys(self::$encoders)))), $encoding));
}
$this->encoding = $encoding;
}
@@ -151,7 +153,7 @@ class TextPart extends AbstractPart
if ($this->body instanceof File) {
$path = $this->body->getPath();
if (false === $handle = @fopen($path, 'r', false)) {
throw new InvalidArgumentException(sprintf('Unable to open path "%s".', $path));
throw new InvalidArgumentException(\sprintf('Unable to open path "%s".', $path));
}
yield from $this->getEncoder()->encodeByteStream($handle);
@@ -211,7 +213,20 @@ class TextPart extends AbstractPart
return self::$encoders[$this->encoding] ??= new QpContentEncoder();
}
return self::$encoders[$this->encoding] ??= new Base64ContentEncoder();
if ('base64' === $this->encoding) {
return self::$encoders[$this->encoding] ??= new Base64ContentEncoder();
}
return self::$encoders[$this->encoding];
}
public static function addEncoder(ContentEncoderInterface $encoder): void
{
if (\in_array($encoder->getName(), self::DEFAULT_ENCODERS, true)) {
throw new InvalidArgumentException('You are not allowed to change the default encoders ("quoted-printable", "base64", and "8bit").');
}
self::$encoders[$encoder->getName()] = $encoder;
}
private function chooseEncoding(): string
@@ -26,7 +26,7 @@ final class EmailAddressContains extends Constraint
public function toString(): string
{
return sprintf('contains address "%s" with value "%s"', $this->headerName, $this->expectedValue);
return \sprintf('contains address "%s" with value "%s"', $this->headerName, $this->expectedValue);
}
/**
@@ -59,6 +59,6 @@ final class EmailAddressContains extends Constraint
*/
protected function failureDescription($message): string
{
return sprintf('the Email %s (value is %s)', $this->toString(), $message->getHeaders()->get($this->headerName)->getBodyAsString());
return \sprintf('the Email %s (value is %s)', $this->toString(), $message->getHeaders()->get($this->headerName)->getBodyAsString());
}
}
@@ -19,13 +19,12 @@ final class EmailAttachmentCount extends Constraint
{
public function __construct(
private int $expectedValue,
private ?string $transport = null,
) {
}
public function toString(): string
{
return sprintf('has sent "%d" attachment(s)', $this->expectedValue);
return \sprintf('has sent "%d" attachment(s)', $this->expectedValue);
}
/**
+1 -1
View File
@@ -23,7 +23,7 @@ final class EmailHasHeader extends Constraint
public function toString(): string
{
return sprintf('has header "%s"', $this->headerName);
return \sprintf('has header "%s"', $this->headerName);
}
/**
+2 -2
View File
@@ -25,7 +25,7 @@ final class EmailHeaderSame extends Constraint
public function toString(): string
{
return sprintf('has header "%s" with value "%s"', $this->headerName, $this->expectedValue);
return \sprintf('has header "%s" with value "%s"', $this->headerName, $this->expectedValue);
}
/**
@@ -45,7 +45,7 @@ final class EmailHeaderSame extends Constraint
*/
protected function failureDescription($message): string
{
return sprintf('the Email %s (value is %s)', $this->toString(), $this->getHeaderValue($message) ?? 'null');
return \sprintf('the Email %s (value is %s)', $this->toString(), $this->getHeaderValue($message) ?? 'null');
}
private function getHeaderValue($message): ?string
@@ -24,7 +24,7 @@ final class EmailHtmlBodyContains extends Constraint
public function toString(): string
{
return sprintf('contains "%s"', $this->expectedText);
return \sprintf('contains "%s"', $this->expectedText);
}
/**
@@ -23,7 +23,7 @@ final class EmailSubjectContains extends Constraint
public function toString(): string
{
return sprintf('contains subject with value "%s"', $this->expectedSubjectValue);
return \sprintf('contains subject with value "%s"', $this->expectedSubjectValue);
}
protected function matches($other): bool
@@ -39,7 +39,7 @@ final class EmailSubjectContains extends Constraint
{
$message = 'The email subject '.$this->toString();
if ($other instanceof Email) {
$message .= sprintf('. The subject was: "%s"', $other->getSubject() ?? '<empty>');
$message .= \sprintf('. The subject was: "%s"', $other->getSubject() ?? '<empty>');
}
return $message;
@@ -24,7 +24,7 @@ final class EmailTextBodyContains extends Constraint
public function toString(): string
{
return sprintf('contains "%s"', $this->expectedText);
return \sprintf('contains "%s"', $this->expectedText);
}
/**