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