rebase code on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:51:46 -04:00
parent b16ad94b69
commit 8f1a2c3a66
2197 changed files with 184921 additions and 35568 deletions

View File

@@ -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,6 +194,8 @@ 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)

View File

@@ -109,6 +109,8 @@ final class BufferStream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamIn
return \strlen($string);
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)

View File

@@ -139,6 +139,8 @@ 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)

View File

@@ -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;

View File

@@ -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.
*
* @see http://tools.ietf.org/html/rfc1950
* @see http://tools.ietf.org/html/rfc1952
* @see http://php.net/manual/en/filters.compression.php
* @link http://tools.ietf.org/html/rfc1950
* @link http://tools.ietf.org/html/rfc1952
* @link http://php.net/manual/en/filters.compression.php
*/
final class InflateStream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamInterface
{

View File

@@ -26,7 +26,7 @@ final class Message
throw new \InvalidArgumentException('Unknown message type');
}
foreach ($message->getHeaders() as $name => $values) {
if (\is_string($name) && \strtolower($name) === 'set-cookie') {
if (\strtolower($name) === 'set-cookie') {
foreach ($values as $value) {
$msg .= "\r\n{$name}: " . $value;
}

View File

@@ -10,9 +10,9 @@ use WPMailSMTP\Vendor\Psr\Http\Message\StreamInterface;
*/
trait MessageTrait
{
/** @var string[][] Map of all registered headers, as original name => array of values */
/** @var array<string, string[]> Map of all registered headers, as original name => array of values */
private $headers = [];
/** @var string[] Map of lowercase header name => original name at registration */
/** @var array<string, 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

View File

@@ -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,7 +105,9 @@ 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)) {
$headers['Content-Type'] = \WPMailSMTP\Vendor\GuzzleHttp\Psr7\MimeType::fromFilename($filename) ?? 'application/octet-stream';
if ($type = \WPMailSMTP\Vendor\GuzzleHttp\Psr7\MimeType::fromFilename($filename)) {
$headers['Content-Type'] = $type;
}
}
return [$stream, $headers];
}

View File

@@ -27,7 +27,7 @@ final class PumpStream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamInte
/** @var BufferStream */
private $buffer;
/**
* @param callable(int): (string|false|null) $source Source of the stream data. The callable MAY
* @param callable(int): (string|null|false) $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,6 +123,8 @@ final class PumpStream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamInte
return $result;
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)

View File

@@ -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.
*
* @see https://github.com/amphp/http/blob/v1.0.1/src/Rfc7230.php#L12-L15
* @link 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
*/

View File

@@ -222,6 +222,8 @@ class ServerRequest extends \WPMailSMTP\Vendor\GuzzleHttp\Psr7\Request implement
return $new;
}
/**
* {@inheritdoc}
*
* @return array|object|null
*/
public function getParsedBody()
@@ -239,6 +241,8 @@ class ServerRequest extends \WPMailSMTP\Vendor\GuzzleHttp\Psr7\Request implement
return $this->attributes;
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getAttribute($attribute, $default = null)

View File

@@ -218,6 +218,8 @@ class Stream implements \WPMailSMTP\Vendor\Psr\Http\Message\StreamInterface
return $result;
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)

View File

@@ -69,6 +69,8 @@ trait StreamDecoratorTrait
$this->stream->close();
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)

View File

@@ -25,13 +25,13 @@ class Uri implements \WPMailSMTP\Vendor\Psr\Http\Message\UriInterface, \JsonSeri
/**
* Unreserved characters for use in a regex.
*
* @see https://tools.ietf.org/html/rfc3986#section-2.3
* @link https://tools.ietf.org/html/rfc3986#section-2.3
*/
private const CHAR_UNRESERVED = 'a-zA-Z0-9_\\-\\.~';
/**
* Sub-delims for use in a regex.
*
* @see https://tools.ietf.org/html/rfc3986#section-2.2
* @link 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).
*
* @see https://tools.ietf.org/html/rfc3986#section-5.3
* @link 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
* @see https://tools.ietf.org/html/rfc3986#section-4
* @link 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.
*
* @see https://tools.ietf.org/html/rfc3986#section-4.2
* @link 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.
*
* @see https://tools.ietf.org/html/rfc3986#section-4.2
* @link 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.
*
* @see https://tools.ietf.org/html/rfc3986#section-4.2
* @link 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
*
* @see https://tools.ietf.org/html/rfc3986#section-4.4
* @link 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.
*
* @see http://php.net/manual/en/function.parse-url.php
* @link http://php.net/manual/en/function.parse-url.php
*
* @throws MalformedUriException If the components do not form a valid URI.
*/

View File

@@ -9,7 +9,7 @@ use WPMailSMTP\Vendor\Psr\Http\Message\UriInterface;
*
* @author Tobias Schultze
*
* @see https://tools.ietf.org/html/rfc3986#section-6
* @link 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
*
* @see https://tools.ietf.org/html/rfc3986#section-6.2
* @link 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
*
* @see https://tools.ietf.org/html/rfc3986#section-6.1
* @link 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
{

View File

@@ -9,14 +9,14 @@ use WPMailSMTP\Vendor\Psr\Http\Message\UriInterface;
*
* @author Tobias Schultze
*
* @see https://tools.ietf.org/html/rfc3986#section-5
* @link https://tools.ietf.org/html/rfc3986#section-5
*/
final class UriResolver
{
/**
* Removes dot segments from a path and returns the new path.
*
* @see http://tools.ietf.org/html/rfc3986#section-5.2.4
* @link 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.
*
* @see http://tools.ietf.org/html/rfc3986#section-5.2
* @link 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
{

View File

@@ -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;