Debian Codegraph @

vendor/guzzlehttp/psr7/src/NoSeekStream.php

raw
1 <?php
2
3 declare(strict_types=1);
4
5 namespace GuzzleHttp\Psr7;
6
7 use Psr\Http\Message\StreamInterface;
8
9 /**
10 * Stream decorator that prevents a stream from being seeked.
11 */
12 final class NoSeekStream implements StreamInterface
13 {
14 use StreamDecoratorTrait;
15
16 /** @var StreamInterface */
17 private $stream;
18
19 public function seek($offset, $whence = SEEK_SET): void
20 {
21 if (!\is_int($offset)) {
22 \trigger_deprecation(
23 'guzzlehttp/psr7',
24 '2.11',
25 'Passing %s to StreamInterface::seek() is deprecated; guzzlehttp/psr7 3.0 requires int for $offset.',
26 \get_debug_type($offset)
27 );
28 }
29
30 if (!\is_int($whence)) {
31 \trigger_deprecation(
32 'guzzlehttp/psr7',
33 '2.11',
34 'Passing %s to StreamInterface::seek() is deprecated; guzzlehttp/psr7 3.0 requires int for $whence.',
35 \get_debug_type($whence)
36 );
37 }
38
39 throw new \RuntimeException('Cannot seek a NoSeekStream');
40 }
41
42 public function isSeekable(): bool
43 {
44 return false;
45 }
46 }