diff --git a/src/Internal/PsrStreamBody.php b/src/Internal/PsrStreamBody.php index 94bb46b..a3fb879 100644 --- a/src/Internal/PsrStreamBody.php +++ b/src/Internal/PsrStreamBody.php @@ -22,7 +22,7 @@ public function getContent(): ReadableStream public function getContentLength(): ?int { - return $this->stream->getSize() ?? -1; + return $this->stream->getSize(); } public function getContentType(): ?string diff --git a/test/Internal/PsrStreamBodyTest.php b/test/Internal/PsrStreamBodyTest.php index 31f32a8..6c9e60d 100644 --- a/test/Internal/PsrStreamBodyTest.php +++ b/test/Internal/PsrStreamBodyTest.php @@ -15,7 +15,7 @@ class PsrStreamBodyTest extends TestCase /** * @dataProvider providerBodyLength */ - public function testGetBodyLengthReturnsValueFromStream(?int $size, int $expectedSize): void + public function testGetBodyLengthReturnsValueFromStream(?int $size, ?int $expectedSize): void { $stream = $this->createMock(StreamInterface::class); $stream->method('getSize')->willReturn($size); @@ -30,7 +30,7 @@ public function providerBodyLength(): array return [ 'Stream provides zero size' => [0, 0], 'Stream provides positive size' => [1, 1], - 'Stream doesn\'t provide its size' => [null, -1], + 'Stream doesn\'t provide its size' => [null, null], ]; }