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/phpunit.xml.dist b/phpunit.xml.dist
index 034d22e..f12146d 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -8,7 +8,6 @@
tests/
- tests/SocketClientFeatureTest.php
diff --git a/src/Stream.php b/src/Stream.php
index 8d26ca0..0c059ca 100644
--- a/src/Stream.php
+++ b/src/Stream.php
@@ -61,7 +61,7 @@ public function __construct(RequestInterface $request, $socket, ?int $size = nul
$this->request = $request;
}
- public function __toString()
+ public function __toString(): string
{
try {
return $this->getContents();
@@ -70,7 +70,7 @@ public function __toString()
}
}
- public function close()
+ public function close(): void
{
if ($this->isDetached || null === $this->socket) {
throw new StreamException('Stream is detached');
@@ -93,12 +93,12 @@ public function detach()
/**
* @return int<0, max>|null
*/
- public function getSize()
+ public function getSize(): ?int
{
return $this->size;
}
- public function tell()
+ public function tell(): int
{
if ($this->isDetached || null === $this->socket) {
throw new StreamException('Stream is detached');
@@ -111,7 +111,7 @@ public function tell()
return $tell;
}
- public function eof()
+ public function eof(): bool
{
if ($this->isDetached || null === $this->socket) {
throw new StreamException('Stream is detached');
@@ -120,38 +120,32 @@ public function eof()
return feof($this->socket);
}
- public function isSeekable()
+ public function isSeekable(): bool
{
return false;
}
- /**
- * @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');
}
- /**
- * @return void
- */
- public function rewind()
+ public function rewind(): void
{
throw new StreamException('This stream is not seekable');
}
- public function isWritable()
+ public function isWritable(): bool
{
return false;
}
- public function write($string)
+ public function write($string): int
{
throw new StreamException('This stream is not writable');
}
- public function isReadable()
+ public function isReadable(): bool
{
return true;
}
@@ -159,7 +153,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');
@@ -197,7 +191,7 @@ public function read($length)
return $read;
}
- public function getContents()
+ public function getContents(): string
{
if ($this->isDetached || null === $this->socket) {
throw new StreamException('Stream is detached');