This commit is contained in:
wangjinlei
2024-12-31 10:28:40 +08:00
parent 145b0ab8a5
commit a54a837670
1179 changed files with 2686 additions and 230376 deletions

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Psr\Http\Message;
/**
@@ -25,14 +27,14 @@ interface StreamInterface
* @see http://php.net/manual/en/language.oop5.magic.php#object.tostring
* @return string
*/
public function __toString(): string;
public function __toString();
/**
* Closes the stream and any underlying resources.
*
* @return void
*/
public function close(): void;
public function close();
/**
* Separates any underlying resources from the stream.
@@ -48,7 +50,7 @@ interface StreamInterface
*
* @return int|null Returns the size in bytes if known, or null if unknown.
*/
public function getSize(): ?int;
public function getSize();
/**
* Returns the current position of the file read/write pointer
@@ -56,21 +58,21 @@ interface StreamInterface
* @return int Position of the file pointer
* @throws \RuntimeException on error.
*/
public function tell(): int;
public function tell();
/**
* Returns true if the stream is at the end of the stream.
*
* @return bool
*/
public function eof(): bool;
public function eof();
/**
* Returns whether or not the stream is seekable.
*
* @return bool
*/
public function isSeekable(): bool;
public function isSeekable();
/**
* Seek to a position in the stream.
@@ -84,7 +86,7 @@ interface StreamInterface
* SEEK_END: Set position to end-of-stream plus offset.
* @throws \RuntimeException on failure.
*/
public function seek(int $offset, int $whence = SEEK_SET): void;
public function seek(int $offset, int $whence = SEEK_SET);
/**
* Seek to the beginning of the stream.
@@ -96,14 +98,14 @@ interface StreamInterface
* @link http://www.php.net/manual/en/function.fseek.php
* @throws \RuntimeException on failure.
*/
public function rewind(): void;
public function rewind();
/**
* Returns whether or not the stream is writable.
*
* @return bool
*/
public function isWritable(): bool;
public function isWritable();
/**
* Write data to the stream.
@@ -112,14 +114,14 @@ interface StreamInterface
* @return int Returns the number of bytes written to the stream.
* @throws \RuntimeException on failure.
*/
public function write(string $string): int;
public function write(string $string);
/**
* Returns whether or not the stream is readable.
*
* @return bool
*/
public function isReadable(): bool;
public function isReadable();
/**
* Read data from the stream.
@@ -131,7 +133,7 @@ interface StreamInterface
* if no bytes are available.
* @throws \RuntimeException if an error occurs.
*/
public function read(int $length): string;
public function read(int $length);
/**
* Returns the remaining contents in a string
@@ -140,7 +142,7 @@ interface StreamInterface
* @throws \RuntimeException if unable to read or an error occurs while
* reading.
*/
public function getContents(): string;
public function getContents();
/**
* Get stream metadata as an associative array or retrieve a specific key.