diff --git a/composer.json b/composer.json index 11542e4..68f6b32 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", "nyholm/psr7": "^1.3", "php-http/httplug": "^2.0", "psr/http-client": "^1.0", diff --git a/src/Stream.php b/src/Stream.php index c2475df..c384863 100644 --- a/src/Stream.php +++ b/src/Stream.php @@ -61,10 +61,7 @@ public function __construct(RequestInterface $request, $socket, ?int $size = nul $this->request = $request; } - /** - * {@inheritdoc} - */ - public function __toString() + public function __toString(): string { try { return $this->getContents(); @@ -73,10 +70,7 @@ public function __toString() } } - /** - * {@inheritdoc} - */ - public function close() + public function close(): void { if ($this->isDetached || null === $this->socket) { throw new StreamException('Stream is detached'); @@ -84,9 +78,6 @@ public function close() fclose($this->socket); } - /** - * {@inheritdoc} - */ public function detach() { if ($this->isDetached) { @@ -104,15 +95,12 @@ public function detach() * * @return int<0, max>|null */ - public function getSize() + public function getSize(): ?int { return $this->size; } - /** - * {@inheritdoc} - */ - public function tell() + public function tell(): int { if ($this->isDetached || null === $this->socket) { throw new StreamException('Stream is detached'); @@ -125,10 +113,7 @@ public function tell() return $tell; } - /** - * {@inheritdoc} - */ - public function eof() + public function eof(): bool { if ($this->isDetached || null === $this->socket) { throw new StreamException('Stream is detached'); @@ -137,54 +122,32 @@ public function eof() return feof($this->socket); } - /** - * {@inheritdoc} - */ - public function isSeekable() + public function isSeekable(): bool { return false; } - /** - * {@inheritdoc} - * - * @return void - */ - public function seek($offset, $whence = SEEK_SET) + public function seek($offset, $whence = SEEK_SET): void { throw new StreamException('This stream is not seekable'); } - /** - * {@inheritdoc} - * - * @return void - */ - public function rewind() + public function rewind(): void { throw new StreamException('This stream is not seekable'); } - /** - * {@inheritdoc} - */ - public function isWritable() + public function isWritable(): bool { return false; } - /** - * {@inheritdoc} - */ - public function write($string) + public function write($string): int { throw new StreamException('This stream is not writable'); } - /** - * {@inheritdoc} - */ - public function isReadable() + public function isReadable(): bool { return true; } @@ -194,7 +157,7 @@ public function isReadable() * * @param int<0, max> $length */ - public function read($length) + public function read($length): string { if ($this->isDetached || null === $this->socket) { throw new StreamException('Stream is detached'); @@ -232,10 +195,7 @@ public function read($length) return $read; } - /** - * {@inheritdoc} - */ - public function getContents() + public function getContents(): string { if ($this->isDetached || null === $this->socket) { throw new StreamException('Stream is detached'); @@ -261,9 +221,6 @@ public function getContents() return $contents; } - /** - * {@inheritdoc} - */ public function getMetadata($key = null) { if ($this->isDetached || null === $this->socket) {