处理 vendor 依赖错误问题

This commit is contained in:
柳清爽
2025-03-25 18:31:48 +08:00
parent f7f48a03fe
commit 4af129acf8
416 changed files with 26268 additions and 28381 deletions

View File

@@ -1,7 +1,5 @@
<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
@@ -13,33 +11,32 @@ use Psr\Http\Message\StreamInterface;
* This stream returns a "hwm" metadata value that tells upstream consumers
* what the configured high water mark of the stream is, or the maximum
* preferred size of the buffer.
*
* @final
*/
final class BufferStream implements StreamInterface
class BufferStream implements StreamInterface
{
/** @var int */
private $hwm;
/** @var string */
private $buffer = '';
/**
* @param int $hwm High water mark, representing the preferred maximum
* buffer size. If the size of the buffer exceeds the high
* water mark, then calls to write will continue to succeed
* but will return 0 to inform writers to slow down
* but will return false to inform writers to slow down
* until the buffer has been drained by reading from it.
*/
public function __construct(int $hwm = 16384)
public function __construct($hwm = 16384)
{
$this->hwm = $hwm;
}
public function __toString(): string
public function __toString()
{
return $this->getContents();
}
public function getContents(): string
public function getContents()
{
$buffer = $this->buffer;
$this->buffer = '';
@@ -47,7 +44,7 @@ final class BufferStream implements StreamInterface
return $buffer;
}
public function close(): void
public function close()
{
$this->buffer = '';
}
@@ -59,42 +56,42 @@ final class BufferStream implements StreamInterface
return null;
}
public function getSize(): ?int
public function getSize()
{
return strlen($this->buffer);
}
public function isReadable(): bool
public function isReadable()
{
return true;
}
public function isWritable(): bool
public function isWritable()
{
return true;
}
public function isSeekable(): bool
public function isSeekable()
{
return false;
}
public function rewind(): void
public function rewind()
{
$this->seek(0);
}
public function seek($offset, $whence = SEEK_SET): void
public function seek($offset, $whence = SEEK_SET)
{
throw new \RuntimeException('Cannot seek a BufferStream');
}
public function eof(): bool
public function eof()
{
return strlen($this->buffer) === 0;
}
public function tell(): int
public function tell()
{
throw new \RuntimeException('Cannot determine the position of a BufferStream');
}
@@ -102,7 +99,7 @@ final class BufferStream implements StreamInterface
/**
* Reads data from the buffer.
*/
public function read($length): string
public function read($length)
{
$currentLength = strlen($this->buffer);
@@ -122,23 +119,21 @@ final class BufferStream implements StreamInterface
/**
* Writes data to the buffer.
*/
public function write($string): int
public function write($string)
{
$this->buffer .= $string;
// TODO: What should happen here?
if (strlen($this->buffer) >= $this->hwm) {
return 0;
return false;
}
return strlen($string);
}
/**
* @return mixed
*/
public function getMetadata($key = null)
{
if ($key === 'hwm') {
if ($key == 'hwm') {
return $this->hwm;
}