Merged in feature/MAW-855-import-code-into-aws (pull request #2)
code import from pantheon * code import from pantheon
This commit is contained in:
@@ -164,7 +164,7 @@ final class AppendStream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamIn
|
||||
if ($this->current === $total) {
|
||||
break;
|
||||
}
|
||||
$this->current++;
|
||||
++$this->current;
|
||||
}
|
||||
$result = $this->streams[$this->current]->read($remaining);
|
||||
if ($result === '') {
|
||||
@@ -194,8 +194,6 @@ final class AppendStream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamIn
|
||||
throw new \RuntimeException('Cannot write to an AppendStream');
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMetadata($key = null)
|
||||
|
||||
@@ -109,8 +109,6 @@ final class BufferStream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamIn
|
||||
return \strlen($string);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMetadata($key = null)
|
||||
|
||||
@@ -139,8 +139,6 @@ final class FnStream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamInterf
|
||||
return \call_user_func($this->_fn_getContents);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMetadata($key = null)
|
||||
|
||||
@@ -81,7 +81,7 @@ final class Header
|
||||
$v = '';
|
||||
$isQuoted = \false;
|
||||
$isEscaped = \false;
|
||||
for ($i = 0, $max = \strlen($value); $i < $max; $i++) {
|
||||
for ($i = 0, $max = \strlen($value); $i < $max; ++$i) {
|
||||
if ($isEscaped) {
|
||||
$v .= $value[$i];
|
||||
$isEscaped = \false;
|
||||
|
||||
@@ -11,9 +11,9 @@ use WPMailSMTP\Vendor\Psr\Http\Message\StreamInterface;
|
||||
* then appends the zlib.inflate filter. The stream is then converted back
|
||||
* to a Guzzle stream resource to be used as a Guzzle stream.
|
||||
*
|
||||
* @link http://tools.ietf.org/html/rfc1950
|
||||
* @link http://tools.ietf.org/html/rfc1952
|
||||
* @link http://php.net/manual/en/filters.compression.php
|
||||
* @see http://tools.ietf.org/html/rfc1950
|
||||
* @see http://tools.ietf.org/html/rfc1952
|
||||
* @see http://php.net/manual/en/filters.compression.php
|
||||
*/
|
||||
final class InflateStream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamInterface
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ final class Message
|
||||
throw new \InvalidArgumentException('Unknown message type');
|
||||
}
|
||||
foreach ($message->getHeaders() as $name => $values) {
|
||||
if (\strtolower($name) === 'set-cookie') {
|
||||
if (\is_string($name) && \strtolower($name) === 'set-cookie') {
|
||||
foreach ($values as $value) {
|
||||
$msg .= "\r\n{$name}: " . $value;
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ use WPMailSMTP\Vendor\Psr\Http\Message\StreamInterface;
|
||||
*/
|
||||
trait MessageTrait
|
||||
{
|
||||
/** @var array<string, string[]> Map of all registered headers, as original name => array of values */
|
||||
/** @var string[][] Map of all registered headers, as original name => array of values */
|
||||
private $headers = [];
|
||||
/** @var array<string, string> Map of lowercase header name => original name at registration */
|
||||
/** @var string[] Map of lowercase header name => original name at registration */
|
||||
private $headerNames = [];
|
||||
/** @var string */
|
||||
private $protocol = '1.1';
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -61,7 +61,7 @@ final class MultipartStream implements \WPMailSMTP\Vendor\Psr\Http\Message\Strea
|
||||
$stream = new \WPMailSMTP\Vendor\GuzzleHttp\Psr7\AppendStream();
|
||||
foreach ($elements as $element) {
|
||||
if (!\is_array($element)) {
|
||||
throw new \UnexpectedValueException("An array is expected");
|
||||
throw new \UnexpectedValueException('An array is expected');
|
||||
}
|
||||
$this->addElement($stream, $element);
|
||||
}
|
||||
@@ -105,9 +105,7 @@ final class MultipartStream implements \WPMailSMTP\Vendor\Psr\Http\Message\Strea
|
||||
// Set a default Content-Type if one was not supplied
|
||||
$type = $this->getHeader($headers, 'content-type');
|
||||
if (!$type && ($filename === '0' || $filename)) {
|
||||
if ($type = \WPMailSMTP\Vendor\GuzzleHttp\Psr7\MimeType::fromFilename($filename)) {
|
||||
$headers['Content-Type'] = $type;
|
||||
}
|
||||
$headers['Content-Type'] = \WPMailSMTP\Vendor\GuzzleHttp\Psr7\MimeType::fromFilename($filename) ?? 'application/octet-stream';
|
||||
}
|
||||
return [$stream, $headers];
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ final class PumpStream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamInte
|
||||
/** @var BufferStream */
|
||||
private $buffer;
|
||||
/**
|
||||
* @param callable(int): (string|null|false) $source Source of the stream data. The callable MAY
|
||||
* @param callable(int): (string|false|null) $source Source of the stream data. The callable MAY
|
||||
* accept an integer argument used to control the
|
||||
* amount of data to return. The callable MUST
|
||||
* return a string when called, or false|null on error
|
||||
@@ -123,8 +123,6 @@ final class PumpStream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamInte
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMetadata($key = null)
|
||||
|
||||
@@ -13,7 +13,7 @@ final class Rfc7230
|
||||
*
|
||||
* Note: header delimiter (\r\n) is modified to \r?\n to accept line feed only delimiters for BC reasons.
|
||||
*
|
||||
* @link https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15
|
||||
* @see https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15
|
||||
*
|
||||
* @license https://github.com/amphp/http/blob/v1.0.1/LICENSE
|
||||
*/
|
||||
|
||||
@@ -222,8 +222,6 @@ class ServerRequest extends \WPMailSMTP\Vendor\GuzzleHttp\Psr7\Request implement
|
||||
return $new;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return array|object|null
|
||||
*/
|
||||
public function getParsedBody()
|
||||
@@ -241,8 +239,6 @@ class ServerRequest extends \WPMailSMTP\Vendor\GuzzleHttp\Psr7\Request implement
|
||||
return $this->attributes;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAttribute($attribute, $default = null)
|
||||
|
||||
@@ -218,8 +218,6 @@ class Stream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamInterface
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMetadata($key = null)
|
||||
|
||||
@@ -69,8 +69,6 @@ trait StreamDecoratorTrait
|
||||
$this->stream->close();
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMetadata($key = null)
|
||||
|
||||
@@ -25,13 +25,13 @@ class Uri implements \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface, \JsonSeri
|
||||
/**
|
||||
* Unreserved characters for use in a regex.
|
||||
*
|
||||
* @link https://tools.ietf.org/html/rfc3986#section-2.3
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-2.3
|
||||
*/
|
||||
private const CHAR_UNRESERVED = 'a-zA-Z0-9_\\-\\.~';
|
||||
/**
|
||||
* Sub-delims for use in a regex.
|
||||
*
|
||||
* @link https://tools.ietf.org/html/rfc3986#section-2.2
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-2.2
|
||||
*/
|
||||
private const CHAR_SUB_DELIMS = '!\\$&\'\\(\\)\\*\\+,;=';
|
||||
private const QUERY_SEPARATORS_REPLACEMENT = ['=' => '%3D', '&' => '%26'];
|
||||
@@ -118,7 +118,7 @@ class Uri implements \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface, \JsonSeri
|
||||
* `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to
|
||||
* that format).
|
||||
*
|
||||
* @link https://tools.ietf.org/html/rfc3986#section-5.3
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-5.3
|
||||
*/
|
||||
public static function composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment) : string
|
||||
{
|
||||
@@ -165,7 +165,7 @@ class Uri implements \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface, \JsonSeri
|
||||
* @see Uri::isNetworkPathReference
|
||||
* @see Uri::isAbsolutePathReference
|
||||
* @see Uri::isRelativePathReference
|
||||
* @link https://tools.ietf.org/html/rfc3986#section-4
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-4
|
||||
*/
|
||||
public static function isAbsolute(\WPMailSMTP\Vendor\Psr\Http\Message\UriInterface $uri) : bool
|
||||
{
|
||||
@@ -176,7 +176,7 @@ class Uri implements \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface, \JsonSeri
|
||||
*
|
||||
* A relative reference that begins with two slash characters is termed an network-path reference.
|
||||
*
|
||||
* @link https://tools.ietf.org/html/rfc3986#section-4.2
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-4.2
|
||||
*/
|
||||
public static function isNetworkPathReference(\WPMailSMTP\Vendor\Psr\Http\Message\UriInterface $uri) : bool
|
||||
{
|
||||
@@ -187,7 +187,7 @@ class Uri implements \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface, \JsonSeri
|
||||
*
|
||||
* A relative reference that begins with a single slash character is termed an absolute-path reference.
|
||||
*
|
||||
* @link https://tools.ietf.org/html/rfc3986#section-4.2
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-4.2
|
||||
*/
|
||||
public static function isAbsolutePathReference(\WPMailSMTP\Vendor\Psr\Http\Message\UriInterface $uri) : bool
|
||||
{
|
||||
@@ -198,7 +198,7 @@ class Uri implements \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface, \JsonSeri
|
||||
*
|
||||
* A relative reference that does not begin with a slash character is termed a relative-path reference.
|
||||
*
|
||||
* @link https://tools.ietf.org/html/rfc3986#section-4.2
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-4.2
|
||||
*/
|
||||
public static function isRelativePathReference(\WPMailSMTP\Vendor\Psr\Http\Message\UriInterface $uri) : bool
|
||||
{
|
||||
@@ -214,7 +214,7 @@ class Uri implements \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface, \JsonSeri
|
||||
* @param UriInterface $uri The URI to check
|
||||
* @param UriInterface|null $base An optional base URI to compare against
|
||||
*
|
||||
* @link https://tools.ietf.org/html/rfc3986#section-4.4
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-4.4
|
||||
*/
|
||||
public static function isSameDocumentReference(\WPMailSMTP\Vendor\Psr\Http\Message\UriInterface $uri, \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface $base = null) : bool
|
||||
{
|
||||
@@ -276,7 +276,7 @@ class Uri implements \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface, \JsonSeri
|
||||
/**
|
||||
* Creates a URI from a hash of `parse_url` components.
|
||||
*
|
||||
* @link http://php.net/manual/en/function.parse-url.php
|
||||
* @see http://php.net/manual/en/function.parse-url.php
|
||||
*
|
||||
* @throws MalformedUriException If the components do not form a valid URI.
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@ use WPMailSMTP\Vendor\Psr\Http\Message\UriInterface;
|
||||
*
|
||||
* @author Tobias Schultze
|
||||
*
|
||||
* @link https://tools.ietf.org/html/rfc3986#section-6
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-6
|
||||
*/
|
||||
final class UriNormalizer
|
||||
{
|
||||
@@ -102,7 +102,7 @@ final class UriNormalizer
|
||||
* @param UriInterface $uri The URI to normalize
|
||||
* @param int $flags A bitmask of normalizations to apply, see constants
|
||||
*
|
||||
* @link https://tools.ietf.org/html/rfc3986#section-6.2
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-6.2
|
||||
*/
|
||||
public static function normalize(\WPMailSMTP\Vendor\Psr\Http\Message\UriInterface $uri, int $flags = self::PRESERVING_NORMALIZATIONS) : \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface
|
||||
{
|
||||
@@ -146,7 +146,7 @@ final class UriNormalizer
|
||||
* @param UriInterface $uri2 An URI to compare
|
||||
* @param int $normalizations A bitmask of normalizations to apply, see constants
|
||||
*
|
||||
* @link https://tools.ietf.org/html/rfc3986#section-6.1
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-6.1
|
||||
*/
|
||||
public static function isEquivalent(\WPMailSMTP\Vendor\Psr\Http\Message\UriInterface $uri1, \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface $uri2, int $normalizations = self::PRESERVING_NORMALIZATIONS) : bool
|
||||
{
|
||||
|
||||
@@ -9,14 +9,14 @@ use WPMailSMTP\Vendor\Psr\Http\Message\UriInterface;
|
||||
*
|
||||
* @author Tobias Schultze
|
||||
*
|
||||
* @link https://tools.ietf.org/html/rfc3986#section-5
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-5
|
||||
*/
|
||||
final class UriResolver
|
||||
{
|
||||
/**
|
||||
* Removes dot segments from a path and returns the new path.
|
||||
*
|
||||
* @link http://tools.ietf.org/html/rfc3986#section-5.2.4
|
||||
* @see http://tools.ietf.org/html/rfc3986#section-5.2.4
|
||||
*/
|
||||
public static function removeDotSegments(string $path) : string
|
||||
{
|
||||
@@ -46,7 +46,7 @@ final class UriResolver
|
||||
/**
|
||||
* Converts the relative URI into a new URI that is resolved against the base URI.
|
||||
*
|
||||
* @link http://tools.ietf.org/html/rfc3986#section-5.2
|
||||
* @see http://tools.ietf.org/html/rfc3986#section-5.2
|
||||
*/
|
||||
public static function resolve(\WPMailSMTP\Vendor\Psr\Http\Message\UriInterface $base, \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface $rel) : \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface
|
||||
{
|
||||
|
||||
@@ -185,7 +185,7 @@ final class Utils
|
||||
* @param StreamInterface $stream Stream to read from
|
||||
* @param int|null $maxLength Maximum buffer length
|
||||
*/
|
||||
public static function readLine(\WPMailSMTP\Vendor\Psr\Http\Message\StreamInterface $stream, ?int $maxLength = null) : string
|
||||
public static function readLine(\WPMailSMTP\Vendor\Psr\Http\Message\StreamInterface $stream, int $maxLength = null) : string
|
||||
{
|
||||
$buffer = '';
|
||||
$size = 0;
|
||||
|
||||
Reference in New Issue
Block a user