Skip to content

Commit

Permalink
Return null instead of -1
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Sep 3, 2024
1 parent 7335962 commit c853f9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Internal/PsrStreamBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/Internal/PsrStreamBodyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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],
];
}

Expand Down

0 comments on commit c853f9b

Please sign in to comment.