提交的内容

This commit is contained in:
2025-05-12 15:45:02 +08:00
parent 629c4750da
commit b48c692775
3043 changed files with 34732 additions and 60810 deletions

8
vendor/guzzlehttp/psr7/src/AppendStream.php vendored Executable file → Normal file
View File

@ -140,9 +140,9 @@ final class AppendStream implements StreamInterface
public function eof(): bool
{
return !$this->streams ||
($this->current >= count($this->streams) - 1 &&
$this->streams[$this->current]->eof());
return !$this->streams
|| ($this->current >= count($this->streams) - 1
&& $this->streams[$this->current]->eof());
}
public function rewind(): void
@ -239,8 +239,6 @@ final class AppendStream implements StreamInterface
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)

2
vendor/guzzlehttp/psr7/src/BufferStream.php vendored Executable file → Normal file
View File

@ -134,8 +134,6 @@ final class BufferStream implements StreamInterface
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)

2
vendor/guzzlehttp/psr7/src/CachingStream.php vendored Executable file → Normal file
View File

@ -33,7 +33,7 @@ final class CachingStream implements StreamInterface
*/
public function __construct(
StreamInterface $stream,
StreamInterface $target = null
?StreamInterface $target = null
) {
$this->remoteStream = $stream;
$this->stream = $target ?: new Stream(Utils::tryFopen('php://temp', 'r+'));

0
vendor/guzzlehttp/psr7/src/DroppingStream.php vendored Executable file → Normal file
View File

0
vendor/guzzlehttp/psr7/src/Exception/MalformedUriException.php vendored Executable file → Normal file
View File

35
vendor/guzzlehttp/psr7/src/FnStream.php vendored Executable file → Normal file
View File

@ -54,7 +54,7 @@ final class FnStream implements StreamInterface
public function __destruct()
{
if (isset($this->_fn_close)) {
call_user_func($this->_fn_close);
($this->_fn_close)();
}
}
@ -93,7 +93,8 @@ final class FnStream implements StreamInterface
public function __toString(): string
{
try {
return call_user_func($this->_fn___toString);
/** @var string */
return ($this->_fn___toString)();
} catch (\Throwable $e) {
if (\PHP_VERSION_ID >= 70400) {
throw $e;
@ -106,76 +107,74 @@ final class FnStream implements StreamInterface
public function close(): void
{
call_user_func($this->_fn_close);
($this->_fn_close)();
}
public function detach()
{
return call_user_func($this->_fn_detach);
return ($this->_fn_detach)();
}
public function getSize(): ?int
{
return call_user_func($this->_fn_getSize);
return ($this->_fn_getSize)();
}
public function tell(): int
{
return call_user_func($this->_fn_tell);
return ($this->_fn_tell)();
}
public function eof(): bool
{
return call_user_func($this->_fn_eof);
return ($this->_fn_eof)();
}
public function isSeekable(): bool
{
return call_user_func($this->_fn_isSeekable);
return ($this->_fn_isSeekable)();
}
public function rewind(): void
{
call_user_func($this->_fn_rewind);
($this->_fn_rewind)();
}
public function seek($offset, $whence = SEEK_SET): void
{
call_user_func($this->_fn_seek, $offset, $whence);
($this->_fn_seek)($offset, $whence);
}
public function isWritable(): bool
{
return call_user_func($this->_fn_isWritable);
return ($this->_fn_isWritable)();
}
public function write($string): int
{
return call_user_func($this->_fn_write, $string);
return ($this->_fn_write)($string);
}
public function isReadable(): bool
{
return call_user_func($this->_fn_isReadable);
return ($this->_fn_isReadable)();
}
public function read($length): string
{
return call_user_func($this->_fn_read, $length);
return ($this->_fn_read)($length);
}
public function getContents(): string
{
return call_user_func($this->_fn_getContents);
return ($this->_fn_getContents)();
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
return call_user_func($this->_fn_getMetadata, $key);
return ($this->_fn_getMetadata)($key);
}
}

2
vendor/guzzlehttp/psr7/src/Header.php vendored Executable file → Normal file
View File

@ -22,7 +22,7 @@ final class Header
foreach ((array) $header as $value) {
foreach (self::splitList($value) as $val) {
$part = [];
foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) {
foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) ?: [] as $kvp) {
if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) {
$m = $matches[0];
if (isset($m[1])) {

6
vendor/guzzlehttp/psr7/src/HttpFactory.php vendored Executable file → Normal file
View File

@ -27,10 +27,10 @@ final class HttpFactory implements RequestFactoryInterface, ResponseFactoryInter
{
public function createUploadedFile(
StreamInterface $stream,
int $size = null,
?int $size = null,
int $error = \UPLOAD_ERR_OK,
string $clientFilename = null,
string $clientMediaType = null
?string $clientFilename = null,
?string $clientMediaType = null
): UploadedFileInterface {
if ($size === null) {
$size = $stream->getSize();

8
vendor/guzzlehttp/psr7/src/InflateStream.php vendored Executable file → Normal file
View File

@ -13,9 +13,9 @@ use 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
* @see https://datatracker.ietf.org/doc/html/rfc1950
* @see https://datatracker.ietf.org/doc/html/rfc1952
* @see https://www.php.net/manual/en/filters.compression.php
*/
final class InflateStream implements StreamInterface
{
@ -28,7 +28,7 @@ final class InflateStream implements StreamInterface
{
$resource = StreamWrapper::getResource($stream);
// Specify window=15+32, so zlib will use header detection to both gzip (with header) and zlib data
// See http://www.zlib.net/manual.html#Advanced definition of inflateInit2
// See https://www.zlib.net/manual.html#Advanced definition of inflateInit2
// "Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection"
// Default window size is 15.
stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ, ['window' => 15 + 32]);

0
vendor/guzzlehttp/psr7/src/LazyOpenStream.php vendored Executable file → Normal file
View File

0
vendor/guzzlehttp/psr7/src/LimitStream.php vendored Executable file → Normal file
View File

10
vendor/guzzlehttp/psr7/src/Message.php vendored Executable file → Normal file
View File

@ -33,7 +33,7 @@ final class Message
}
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;
}
@ -146,7 +146,7 @@ final class Message
// If these aren't the same, then one line didn't match and there's an invalid header.
if ($count !== substr_count($rawHeaders, "\n")) {
// Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4
// Folding is deprecated, see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4
if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) {
throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding');
}
@ -227,9 +227,9 @@ final class Message
public static function parseResponse(string $message): ResponseInterface
{
$data = self::parseMessage($message);
// According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space
// between status-code and reason-phrase is required. But browsers accept
// responses without space and reason as well.
// According to https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2
// the space between status-code and reason-phrase is required. But
// browsers accept responses without space and reason as well.
if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) {
throw new \InvalidArgumentException('Invalid response string: '.$data['start-line']);
}

12
vendor/guzzlehttp/psr7/src/MessageTrait.php vendored Executable file → Normal file
View File

@ -12,10 +12,10 @@ use 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 */
@ -141,7 +141,7 @@ trait MessageTrait
}
/**
* @param array<string|int, string|string[]> $headers
* @param (string|string[])[] $headers
*/
private function setHeaders(array $headers): void
{
@ -193,7 +193,7 @@ trait MessageTrait
*
* @return string[] Trimmed header values
*
* @see https://tools.ietf.org/html/rfc7230#section-3.2.4
* @see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4
*/
private function trimAndValidateHeaderValues(array $values): array
{
@ -213,7 +213,7 @@ trait MessageTrait
}
/**
* @see https://tools.ietf.org/html/rfc7230#section-3.2
* @see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2
*
* @param mixed $header
*/
@ -234,7 +234,7 @@ trait MessageTrait
}
/**
* @see https://tools.ietf.org/html/rfc7230#section-3.2
* @see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2
*
* field-value = *( field-content / obs-fold )
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]

0
vendor/guzzlehttp/psr7/src/MimeType.php vendored Executable file → Normal file
View File

22
vendor/guzzlehttp/psr7/src/MultipartStream.php vendored Executable file → Normal file
View File

@ -32,7 +32,7 @@ final class MultipartStream implements StreamInterface
*
* @throws \InvalidArgumentException
*/
public function __construct(array $elements = [], string $boundary = null)
public function __construct(array $elements = [], ?string $boundary = null)
{
$this->boundary = $boundary ?: bin2hex(random_bytes(20));
$this->stream = $this->createStream($elements);
@ -51,7 +51,7 @@ final class MultipartStream implements StreamInterface
/**
* Get the headers needed before transferring the content of a POST file
*
* @param array<string, string> $headers
* @param string[] $headers
*/
private function getHeaders(array $headers): string
{
@ -112,10 +112,15 @@ final class MultipartStream implements StreamInterface
$stream->addStream(Utils::streamFor("\r\n"));
}
/**
* @param string[] $headers
*
* @return array{0: StreamInterface, 1: string[]}
*/
private function createElement(string $name, StreamInterface $stream, ?string $filename, array $headers): array
{
// Set a default content-disposition header if one was no provided
$disposition = $this->getHeader($headers, 'content-disposition');
$disposition = self::getHeader($headers, 'content-disposition');
if (!$disposition) {
$headers['Content-Disposition'] = ($filename === '0' || $filename)
? sprintf(
@ -127,7 +132,7 @@ final class MultipartStream implements StreamInterface
}
// Set a default content-length header if one was no provided
$length = $this->getHeader($headers, 'content-length');
$length = self::getHeader($headers, 'content-length');
if (!$length) {
if ($length = $stream->getSize()) {
$headers['Content-Length'] = (string) $length;
@ -135,7 +140,7 @@ final class MultipartStream implements StreamInterface
}
// Set a default Content-Type if one was not supplied
$type = $this->getHeader($headers, 'content-type');
$type = self::getHeader($headers, 'content-type');
if (!$type && ($filename === '0' || $filename)) {
$headers['Content-Type'] = MimeType::fromFilename($filename) ?? 'application/octet-stream';
}
@ -143,11 +148,14 @@ final class MultipartStream implements StreamInterface
return [$stream, $headers];
}
private function getHeader(array $headers, string $key)
/**
* @param string[] $headers
*/
private static function getHeader(array $headers, string $key): ?string
{
$lowercaseHeader = strtolower($key);
foreach ($headers as $k => $v) {
if (strtolower($k) === $lowercaseHeader) {
if (strtolower((string) $k) === $lowercaseHeader) {
return $v;
}
}

0
vendor/guzzlehttp/psr7/src/NoSeekStream.php vendored Executable file → Normal file
View File

10
vendor/guzzlehttp/psr7/src/PumpStream.php vendored Executable file → Normal file
View File

@ -18,7 +18,7 @@ use Psr\Http\Message\StreamInterface;
*/
final class PumpStream implements StreamInterface
{
/** @var callable|null */
/** @var callable(int): (string|false|null)|null */
private $source;
/** @var int|null */
@ -34,7 +34,7 @@ final class PumpStream implements StreamInterface
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
@ -150,8 +150,6 @@ final class PumpStream implements StreamInterface
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
@ -165,9 +163,9 @@ final class PumpStream implements StreamInterface
private function pump(int $length): void
{
if ($this->source) {
if ($this->source !== null) {
do {
$data = call_user_func($this->source, $length);
$data = ($this->source)($length);
if ($data === false || $data === null) {
$this->source = null;

19
vendor/guzzlehttp/psr7/src/Query.php vendored Executable file → Normal file
View File

@ -63,12 +63,15 @@ final class Query
* string. This function does not modify the provided keys when an array is
* encountered (like `http_build_query()` would).
*
* @param array $params Query string parameters.
* @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986
* to encode using RFC3986, or PHP_QUERY_RFC1738
* to encode using RFC1738.
* @param array $params Query string parameters.
* @param int|false $encoding Set to false to not encode,
* PHP_QUERY_RFC3986 to encode using
* RFC3986, or PHP_QUERY_RFC1738 to
* encode using RFC1738.
* @param bool $treatBoolsAsInts Set to true to encode as 0/1, and
* false as false/true.
*/
public static function build(array $params, $encoding = PHP_QUERY_RFC3986): string
public static function build(array $params, $encoding = PHP_QUERY_RFC3986, bool $treatBoolsAsInts = true): string
{
if (!$params) {
return '';
@ -86,12 +89,14 @@ final class Query
throw new \InvalidArgumentException('Invalid type');
}
$castBool = $treatBoolsAsInts ? static function ($v) { return (int) $v; } : static function ($v) { return $v ? 'true' : 'false'; };
$qs = '';
foreach ($params as $k => $v) {
$k = $encoder((string) $k);
if (!is_array($v)) {
$qs .= $k;
$v = is_bool($v) ? (int) $v : $v;
$v = is_bool($v) ? $castBool($v) : $v;
if ($v !== null) {
$qs .= '='.$encoder((string) $v);
}
@ -99,7 +104,7 @@ final class Query
} else {
foreach ($v as $vv) {
$qs .= $k;
$vv = is_bool($vv) ? (int) $vv : $vv;
$vv = is_bool($vv) ? $castBool($vv) : $vv;
if ($vv !== null) {
$qs .= '='.$encoder((string) $vv);
}

4
vendor/guzzlehttp/psr7/src/Request.php vendored Executable file → Normal file
View File

@ -28,7 +28,7 @@ class Request implements RequestInterface
/**
* @param string $method HTTP method
* @param string|UriInterface $uri URI
* @param array<string, string|string[]> $headers Request headers
* @param (string|string[])[] $headers Request headers
* @param string|resource|StreamInterface|null $body Request body
* @param string $version Protocol version
*/
@ -143,7 +143,7 @@ class Request implements RequestInterface
$this->headerNames['host'] = 'Host';
}
// Ensure Host is the first header.
// See: http://tools.ietf.org/html/rfc7230#section-5.4
// See: https://datatracker.ietf.org/doc/html/rfc7230#section-5.4
$this->headers = [$header => [$host]] + $this->headers;
}

4
vendor/guzzlehttp/psr7/src/Response.php vendored Executable file → Normal file
View File

@ -86,7 +86,7 @@ class Response implements ResponseInterface
/**
* @param int $status Status code
* @param array<string, string|string[]> $headers Response headers
* @param (string|string[])[] $headers Response headers
* @param string|resource|StreamInterface|null $body Response body
* @param string $version Protocol version
* @param string|null $reason Reason phrase (when empty a default will be used based on the status code)
@ -96,7 +96,7 @@ class Response implements ResponseInterface
array $headers = [],
$body = null,
string $version = '1.1',
string $reason = null
?string $reason = null
) {
$this->assertStatusCodeRange($status);

0
vendor/guzzlehttp/psr7/src/Rfc7230.php vendored Executable file → Normal file
View File

6
vendor/guzzlehttp/psr7/src/ServerRequest.php vendored Executable file → Normal file
View File

@ -59,7 +59,7 @@ class ServerRequest extends Request implements ServerRequestInterface
/**
* @param string $method HTTP method
* @param string|UriInterface $uri URI
* @param array<string, string|string[]> $headers Request headers
* @param (string|string[])[] $headers Request headers
* @param string|resource|StreamInterface|null $body Request body
* @param string $version Protocol version
* @param array $serverParams Typically the $_SERVER superglobal
@ -286,8 +286,6 @@ class ServerRequest extends Request implements ServerRequestInterface
}
/**
* {@inheritdoc}
*
* @return array|object|null
*/
public function getParsedBody()
@ -309,8 +307,6 @@ class ServerRequest extends Request implements ServerRequestInterface
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getAttribute($attribute, $default = null)

6
vendor/guzzlehttp/psr7/src/Stream.php vendored Executable file → Normal file
View File

@ -12,8 +12,8 @@ use Psr\Http\Message\StreamInterface;
class Stream implements StreamInterface
{
/**
* @see http://php.net/manual/function.fopen.php
* @see http://php.net/manual/en/function.gzopen.php
* @see https://www.php.net/manual/en/function.fopen.php
* @see https://www.php.net/manual/en/function.gzopen.php
*/
private const READABLE_MODES = '/r|a\+|ab\+|w\+|wb\+|x\+|xb\+|c\+|cb\+/';
private const WRITABLE_MODES = '/a|w|r\+|rb\+|rw|x|c/';
@ -264,8 +264,6 @@ class Stream implements StreamInterface
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)

4
vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php vendored Executable file → Normal file
View File

@ -70,7 +70,7 @@ trait StreamDecoratorTrait
{
/** @var callable $callable */
$callable = [$this->stream, $method];
$result = call_user_func_array($callable, $args);
$result = ($callable)(...$args);
// Always return the wrapped object if the result is a return $this
return $result === $this->stream ? $this : $result;
@ -82,8 +82,6 @@ trait StreamDecoratorTrait
}
/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)

40
vendor/guzzlehttp/psr7/src/StreamWrapper.php vendored Executable file → Normal file
View File

@ -69,7 +69,7 @@ final class StreamWrapper
}
}
public function stream_open(string $path, string $mode, int $options, string &$opened_path = null): bool
public function stream_open(string $path, string $mode, int $options, ?string &$opened_path = null): bool
{
$options = stream_context_get_options($this->context);
@ -122,10 +122,28 @@ final class StreamWrapper
}
/**
* @return array<int|string, int>
* @return array{
* dev: int,
* ino: int,
* mode: int,
* nlink: int,
* uid: int,
* gid: int,
* rdev: int,
* size: int,
* atime: int,
* mtime: int,
* ctime: int,
* blksize: int,
* blocks: int
* }|false
*/
public function stream_stat(): array
public function stream_stat()
{
if ($this->stream->getSize() === null) {
return false;
}
static $modeMap = [
'r' => 33060,
'rb' => 33060,
@ -152,7 +170,21 @@ final class StreamWrapper
}
/**
* @return array<int|string, int>
* @return array{
* dev: int,
* ino: int,
* mode: int,
* nlink: int,
* uid: int,
* gid: int,
* rdev: int,
* size: int,
* atime: int,
* mtime: int,
* ctime: int,
* blksize: int,
* blocks: int
* }
*/
public function url_stat(string $path, int $flags): array
{

30
vendor/guzzlehttp/psr7/src/UploadedFile.php vendored Executable file → Normal file
View File

@ -11,15 +11,15 @@ use RuntimeException;
class UploadedFile implements UploadedFileInterface
{
private const ERRORS = [
UPLOAD_ERR_OK,
UPLOAD_ERR_INI_SIZE,
UPLOAD_ERR_FORM_SIZE,
UPLOAD_ERR_PARTIAL,
UPLOAD_ERR_NO_FILE,
UPLOAD_ERR_NO_TMP_DIR,
UPLOAD_ERR_CANT_WRITE,
UPLOAD_ERR_EXTENSION,
private const ERROR_MAP = [
UPLOAD_ERR_OK => 'UPLOAD_ERR_OK',
UPLOAD_ERR_INI_SIZE => 'UPLOAD_ERR_INI_SIZE',
UPLOAD_ERR_FORM_SIZE => 'UPLOAD_ERR_FORM_SIZE',
UPLOAD_ERR_PARTIAL => 'UPLOAD_ERR_PARTIAL',
UPLOAD_ERR_NO_FILE => 'UPLOAD_ERR_NO_FILE',
UPLOAD_ERR_NO_TMP_DIR => 'UPLOAD_ERR_NO_TMP_DIR',
UPLOAD_ERR_CANT_WRITE => 'UPLOAD_ERR_CANT_WRITE',
UPLOAD_ERR_EXTENSION => 'UPLOAD_ERR_EXTENSION',
];
/**
@ -64,8 +64,8 @@ class UploadedFile implements UploadedFileInterface
$streamOrFile,
?int $size,
int $errorStatus,
string $clientFilename = null,
string $clientMediaType = null
?string $clientFilename = null,
?string $clientMediaType = null
) {
$this->setError($errorStatus);
$this->size = $size;
@ -104,7 +104,7 @@ class UploadedFile implements UploadedFileInterface
*/
private function setError(int $error): void
{
if (false === in_array($error, UploadedFile::ERRORS, true)) {
if (!isset(UploadedFile::ERROR_MAP[$error])) {
throw new InvalidArgumentException(
'Invalid error status for UploadedFile'
);
@ -113,7 +113,7 @@ class UploadedFile implements UploadedFileInterface
$this->error = $error;
}
private function isStringNotEmpty($param): bool
private static function isStringNotEmpty($param): bool
{
return is_string($param) && false === empty($param);
}
@ -137,7 +137,7 @@ class UploadedFile implements UploadedFileInterface
private function validateActive(): void
{
if (false === $this->isOk()) {
throw new RuntimeException('Cannot retrieve stream due to upload error');
throw new RuntimeException(\sprintf('Cannot retrieve stream due to upload error (%s)', self::ERROR_MAP[$this->error]));
}
if ($this->isMoved()) {
@ -163,7 +163,7 @@ class UploadedFile implements UploadedFileInterface
{
$this->validateActive();
if (false === $this->isStringNotEmpty($targetPath)) {
if (false === self::isStringNotEmpty($targetPath)) {
throw new InvalidArgumentException(
'Invalid path provided for move operation; must be a non-empty string'
);

32
vendor/guzzlehttp/psr7/src/Uri.php vendored Executable file → Normal file
View File

@ -41,14 +41,14 @@ class Uri implements UriInterface, \JsonSerializable
/**
* Unreserved characters for use in a regex.
*
* @see https://tools.ietf.org/html/rfc3986#section-2.3
* @see https://datatracker.ietf.org/doc/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
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-2.2
*/
private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';
private const QUERY_SEPARATORS_REPLACEMENT = ['=' => '%3D', '&' => '%26'];
@ -107,7 +107,7 @@ class Uri implements UriInterface, \JsonSerializable
{
// If IPv6
$prefix = '';
if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) {
if (preg_match('%^(.*://\[[0-9:a-fA-F]+\])(.*?)$%', $url, $matches)) {
/** @var array{0:string, 1:string, 2:string} $matches */
$prefix = $matches[1];
$url = $matches[2];
@ -162,7 +162,7 @@ class Uri implements UriInterface, \JsonSerializable
* `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
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.3
*/
public static function composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment): string
{
@ -219,7 +219,7 @@ class Uri implements UriInterface, \JsonSerializable
* @see Uri::isNetworkPathReference
* @see Uri::isAbsolutePathReference
* @see Uri::isRelativePathReference
* @see https://tools.ietf.org/html/rfc3986#section-4
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-4
*/
public static function isAbsolute(UriInterface $uri): bool
{
@ -231,7 +231,7 @@ class Uri implements UriInterface, \JsonSerializable
*
* 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
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2
*/
public static function isNetworkPathReference(UriInterface $uri): bool
{
@ -243,7 +243,7 @@ class Uri implements UriInterface, \JsonSerializable
*
* 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
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2
*/
public static function isAbsolutePathReference(UriInterface $uri): bool
{
@ -258,7 +258,7 @@ class Uri implements UriInterface, \JsonSerializable
*
* 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
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2
*/
public static function isRelativePathReference(UriInterface $uri): bool
{
@ -277,9 +277,9 @@ class Uri implements UriInterface, \JsonSerializable
* @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
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.4
*/
public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool
public static function isSameDocumentReference(UriInterface $uri, ?UriInterface $base = null): bool
{
if ($base !== null) {
$uri = UriResolver::resolve($base, $uri);
@ -336,8 +336,8 @@ class Uri implements UriInterface, \JsonSerializable
*
* It has the same behavior as withQueryValue() but for an associative array of key => value.
*
* @param UriInterface $uri URI to use as a base.
* @param array<string, string|null> $keyValueArray Associative array of key and values
* @param UriInterface $uri URI to use as a base.
* @param (string|null)[] $keyValueArray Associative array of key and values
*/
public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface
{
@ -353,7 +353,7 @@ class Uri implements UriInterface, \JsonSerializable
/**
* Creates a URI from a hash of `parse_url` components.
*
* @see http://php.net/manual/en/function.parse-url.php
* @see https://www.php.net/manual/en/function.parse-url.php
*
* @throws MalformedUriException If the components do not form a valid URI.
*/
@ -638,7 +638,7 @@ class Uri implements UriInterface, \JsonSerializable
}
/**
* @param string[] $keys
* @param (string|int)[] $keys
*
* @return string[]
*/
@ -650,7 +650,9 @@ class Uri implements UriInterface, \JsonSerializable
return [];
}
$decodedKeys = array_map('rawurldecode', $keys);
$decodedKeys = array_map(function ($k): string {
return rawurldecode((string) $k);
}, $keys);
return array_filter(explode('&', $current), function ($part) use ($decodedKeys) {
return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true);

0
vendor/guzzlehttp/psr7/src/UriComparator.php vendored Executable file → Normal file
View File

14
vendor/guzzlehttp/psr7/src/UriNormalizer.php vendored Executable file → Normal file
View File

@ -11,7 +11,7 @@ use Psr\Http\Message\UriInterface;
*
* @author Tobias Schultze
*
* @see https://tools.ietf.org/html/rfc3986#section-6
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-6
*/
final class UriNormalizer
{
@ -119,7 +119,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
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-6.2
*/
public static function normalize(UriInterface $uri, int $flags = self::PRESERVING_NORMALIZATIONS): UriInterface
{
@ -131,8 +131,8 @@ final class UriNormalizer
$uri = self::decodeUnreservedCharacters($uri);
}
if ($flags & self::CONVERT_EMPTY_PATH && $uri->getPath() === '' &&
($uri->getScheme() === 'http' || $uri->getScheme() === 'https')
if ($flags & self::CONVERT_EMPTY_PATH && $uri->getPath() === ''
&& ($uri->getScheme() === 'http' || $uri->getScheme() === 'https')
) {
$uri = $uri->withPath('/');
}
@ -174,7 +174,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
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-6.1
*/
public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, int $normalizations = self::PRESERVING_NORMALIZATIONS): bool
{
@ -185,7 +185,7 @@ final class UriNormalizer
{
$regex = '/(?:%[A-Fa-f0-9]{2})++/';
$callback = function (array $match) {
$callback = function (array $match): string {
return strtoupper($match[0]);
};
@ -201,7 +201,7 @@ final class UriNormalizer
{
$regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i';
$callback = function (array $match) {
$callback = function (array $match): string {
return rawurldecode($match[0]);
};

10
vendor/guzzlehttp/psr7/src/UriResolver.php vendored Executable file → Normal file
View File

@ -11,14 +11,14 @@ use Psr\Http\Message\UriInterface;
*
* @author Tobias Schultze
*
* @see https://tools.ietf.org/html/rfc3986#section-5
* @see https://datatracker.ietf.org/doc/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
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4
*/
public static function removeDotSegments(string $path): string
{
@ -53,7 +53,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
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2
*/
public static function resolve(UriInterface $base, UriInterface $rel): UriInterface
{
@ -127,8 +127,8 @@ final class UriResolver
*/
public static function relativize(UriInterface $base, UriInterface $target): UriInterface
{
if ($target->getScheme() !== '' &&
($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '')
if ($target->getScheme() !== ''
&& ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '')
) {
return $target;
}

20
vendor/guzzlehttp/psr7/src/Utils.php vendored Executable file → Normal file
View File

@ -14,18 +14,18 @@ final class Utils
/**
* Remove the items given by the keys, case insensitively from the data.
*
* @param string[] $keys
* @param (string|int)[] $keys
*/
public static function caselessRemove(array $keys, array $data): array
{
$result = [];
foreach ($keys as &$key) {
$key = strtolower($key);
$key = strtolower((string) $key);
}
foreach ($data as $k => $v) {
if (!is_string($k) || !in_array(strtolower($k), $keys)) {
if (!in_array(strtolower((string) $k), $keys)) {
$result[$k] = $v;
}
}
@ -250,6 +250,20 @@ final class Utils
return $buffer;
}
/**
* Redact the password in the user info part of a URI.
*/
public static function redactUserInfo(UriInterface $uri): UriInterface
{
$userInfo = $uri->getUserInfo();
if (false !== ($pos = \strpos($userInfo, ':'))) {
return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***');
}
return $uri;
}
/**
* Create a new stream based on the input type.
*