Skip to content

Commit

Permalink
Merge pull request #165 from php-http/fix-phpstan
Browse files Browse the repository at this point in the history
fix edge case of reading 0 bytes from BufferedStream
  • Loading branch information
dbu authored Oct 2, 2024
2 parents 0d168d2 + e656a72 commit 406f1ba
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Stream/BufferedStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ public function read(int $length): string
if ($length < 0) {
throw new \InvalidArgumentException('Can not read a negative amount of bytes');
}
if (0 === $length) {
return '';
}

$read = '';

Expand Down

0 comments on commit 406f1ba

Please sign in to comment.