mirror of
https://github.com/itflow-org/itflow
synced 2026-08-16 04:25:13 +00:00
Update imapengine dependancies too
This commit is contained in:
90
libs/vendor/guzzlehttp/psr7/src/AppendStream.php
vendored
90
libs/vendor/guzzlehttp/psr7/src/AppendStream.php
vendored
@@ -13,17 +13,16 @@ use Psr\Http\Message\StreamInterface;
|
||||
*/
|
||||
final class AppendStream implements StreamInterface
|
||||
{
|
||||
use NonSerializableStreamTrait;
|
||||
|
||||
/** @var StreamInterface[] Streams being decorated */
|
||||
private $streams = [];
|
||||
private array $streams = [];
|
||||
|
||||
/** @var bool */
|
||||
private $seekable = true;
|
||||
private bool $seekable = true;
|
||||
|
||||
/** @var int */
|
||||
private $current = 0;
|
||||
private int $current = 0;
|
||||
|
||||
/** @var int */
|
||||
private $pos = 0;
|
||||
private int $pos = 0;
|
||||
|
||||
/**
|
||||
* @param StreamInterface[] $streams Streams to decorate. Each stream must
|
||||
@@ -38,18 +37,9 @@ final class AppendStream implements StreamInterface
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
try {
|
||||
$this->rewind();
|
||||
$this->rewind();
|
||||
|
||||
return $this->getContents();
|
||||
} catch (\Throwable $e) {
|
||||
if (\PHP_VERSION_ID >= 70400) {
|
||||
throw $e;
|
||||
}
|
||||
trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR);
|
||||
|
||||
return '';
|
||||
}
|
||||
return $this->getContents();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +122,7 @@ final class AppendStream implements StreamInterface
|
||||
if ($s === null) {
|
||||
return null;
|
||||
}
|
||||
$size += $s;
|
||||
$size = Integers::add($size, $s);
|
||||
}
|
||||
|
||||
return $size;
|
||||
@@ -153,26 +143,8 @@ final class AppendStream implements StreamInterface
|
||||
/**
|
||||
* Attempts to seek to the given position. Only supports SEEK_SET.
|
||||
*/
|
||||
public function seek($offset, $whence = SEEK_SET): void
|
||||
public function seek(int $offset, int $whence = SEEK_SET): void
|
||||
{
|
||||
if (!\is_int($offset)) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/psr7',
|
||||
'2.11',
|
||||
'Passing %s to StreamInterface::seek() is deprecated; guzzlehttp/psr7 3.0 requires int for $offset.',
|
||||
\get_debug_type($offset)
|
||||
);
|
||||
}
|
||||
|
||||
if (!\is_int($whence)) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/psr7',
|
||||
'2.11',
|
||||
'Passing %s to StreamInterface::seek() is deprecated; guzzlehttp/psr7 3.0 requires int for $whence.',
|
||||
\get_debug_type($whence)
|
||||
);
|
||||
}
|
||||
|
||||
if (!$this->seekable) {
|
||||
throw new \RuntimeException('This AppendStream is not seekable');
|
||||
} elseif ($whence !== SEEK_SET) {
|
||||
@@ -203,15 +175,10 @@ final class AppendStream implements StreamInterface
|
||||
/**
|
||||
* Reads from all of the appended streams until the length is met or EOF.
|
||||
*/
|
||||
public function read($length): string
|
||||
public function read(int $length): string
|
||||
{
|
||||
if (!\is_int($length)) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/psr7',
|
||||
'2.11',
|
||||
'Passing %s to StreamInterface::read() is deprecated; guzzlehttp/psr7 3.0 requires int for $length.',
|
||||
\get_debug_type($length)
|
||||
);
|
||||
if ($length < 0) {
|
||||
throw new \RuntimeException('Length parameter cannot be negative');
|
||||
}
|
||||
|
||||
if ($this->streams === []) {
|
||||
@@ -233,7 +200,7 @@ final class AppendStream implements StreamInterface
|
||||
++$this->current;
|
||||
}
|
||||
|
||||
$result = $this->streams[$this->current]->read($remaining);
|
||||
$result = StreamTimeout::read($this->streams[$this->current], $remaining, 'Unable to read from stream: timed out');
|
||||
|
||||
if ($result === '') {
|
||||
$progressToNext = true;
|
||||
@@ -244,7 +211,7 @@ final class AppendStream implements StreamInterface
|
||||
$remaining = $length - strlen($buffer);
|
||||
}
|
||||
|
||||
$this->pos += strlen($buffer);
|
||||
$this->pos = Integers::add($this->pos, strlen($buffer));
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
@@ -264,34 +231,13 @@ final class AppendStream implements StreamInterface
|
||||
return $this->seekable;
|
||||
}
|
||||
|
||||
public function write($string): int
|
||||
public function write(string $string): int
|
||||
{
|
||||
if (!\is_string($string)) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/psr7',
|
||||
'2.11',
|
||||
'Passing %s to StreamInterface::write() is deprecated; guzzlehttp/psr7 3.0 requires string for $string.',
|
||||
\get_debug_type($string)
|
||||
);
|
||||
}
|
||||
|
||||
throw new \RuntimeException('Cannot write to an AppendStream');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMetadata($key = null)
|
||||
public function getMetadata(?string $key = null): ?array
|
||||
{
|
||||
if ($key !== null && !\is_string($key)) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/psr7',
|
||||
'2.11',
|
||||
'Passing %s to StreamInterface::getMetadata() is deprecated; guzzlehttp/psr7 3.0 requires string|null for $key.',
|
||||
\get_debug_type($key)
|
||||
);
|
||||
}
|
||||
|
||||
return $key ? null : [];
|
||||
return $key === null ? [] : null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user