diff options
Diffstat (limited to 'guzzlehttp/psr7/src/DroppingStream.php')
-rw-r--r-- | guzzlehttp/psr7/src/DroppingStream.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/guzzlehttp/psr7/src/DroppingStream.php b/guzzlehttp/psr7/src/DroppingStream.php index 9f7420c4..6e3d209d 100644 --- a/guzzlehttp/psr7/src/DroppingStream.php +++ b/guzzlehttp/psr7/src/DroppingStream.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + namespace GuzzleHttp\Psr7; use Psr\Http\Message\StreamInterface; @@ -7,26 +9,28 @@ use Psr\Http\Message\StreamInterface; /** * Stream decorator that begins dropping data once the size of the underlying * stream becomes too full. - * - * @final */ -class DroppingStream implements StreamInterface +final class DroppingStream implements StreamInterface { use StreamDecoratorTrait; + /** @var int */ private $maxLength; + /** @var StreamInterface */ + private $stream; + /** * @param StreamInterface $stream Underlying stream to decorate. * @param int $maxLength Maximum size before dropping data. */ - public function __construct(StreamInterface $stream, $maxLength) + public function __construct(StreamInterface $stream, int $maxLength) { $this->stream = $stream; $this->maxLength = $maxLength; } - public function write($string) + public function write($string): int { $diff = $this->maxLength - $this->stream->getSize(); |