| @@ -56,9 +56,9 @@ | ||
| 56 | 56 | $meta = \stream_get_meta_data($this->stream); |
| 57 | 57 | $this->seekable = $meta['seekable']; |
| 58 | 58 | $this->readable = (bool) \preg_match(self::READABLE_MODES, $meta['mode']); |
| 59 | 59 | $this->writable = (bool) \preg_match(self::WRITABLE_MODES, $meta['mode']); |
| 60 | - $this->uri = $this->getMetadata('uri'); | |
| 60 | + $this->uri = $meta['uri'] ?? null; | |
| 61 | 61 | } |
| 62 | 62 | /** |
| 63 | 63 | * Closes the stream when the destructed |
| 64 | 64 | */ |
| @@ -165,8 +165,14 @@ | ||
| 165 | 165 | $this->seek(0); |
| 166 | 166 | } |
| 167 | 167 | public function seek($offset, $whence = \SEEK_SET) : void |
| 168 | 168 | { |
| 169 | + if (!\is_int($offset)) { | |
| 170 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/psr7', '2.11', 'Passing %s to StreamInterface::seek() is deprecated; guzzlehttp/psr7 3.0 requires int for $offset.', \get_debug_type($offset)); | |
| 171 | + } | |
| 172 | + if (!\is_int($whence)) { | |
| 173 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/psr7', '2.11', 'Passing %s to StreamInterface::seek() is deprecated; guzzlehttp/psr7 3.0 requires int for $whence.', \get_debug_type($whence)); | |
| 174 | + } | |
| 169 | 175 | $whence = (int) $whence; |
| 170 | 176 | if (!isset($this->stream)) { |
| 171 | 177 | throw new \RuntimeException('Stream is detached'); |
| 172 | 178 | } |
| @@ -178,8 +184,11 @@ | ||
| 178 | 184 | } |
| 179 | 185 | } |
| 180 | 186 | public function read($length) : string |
| 181 | 187 | { |
| 188 | + if (!\is_int($length)) { | |
| 189 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/psr7', '2.11', 'Passing %s to StreamInterface::read() is deprecated; guzzlehttp/psr7 3.0 requires int for $length.', \get_debug_type($length)); | |
| 190 | + } | |
| 182 | 191 | if (!isset($this->stream)) { |
| 183 | 192 | throw new \RuntimeException('Stream is detached'); |
| 184 | 193 | } |
| 185 | 194 | if (!$this->readable) { |
| @@ -202,8 +211,11 @@ | ||
| 202 | 211 | return $string; |
| 203 | 212 | } |
| 204 | 213 | public function write($string) : int |
| 205 | 214 | { |
| 215 | + if (!\is_string($string)) { | |
| 216 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/psr7', '2.11', 'Passing %s to StreamInterface::write() is deprecated; guzzlehttp/psr7 3.0 requires string for $string.', \get_debug_type($string)); | |
| 217 | + } | |
| 206 | 218 | if (!isset($this->stream)) { |
| 207 | 219 | throw new \RuntimeException('Stream is detached'); |
| 208 | 220 | } |
| 209 | 221 | if (!$this->writable) { |
| @@ -221,8 +233,11 @@ | ||
| 221 | 233 | * @return mixed |
| 222 | 234 | */ |
| 223 | 235 | public function getMetadata($key = null) |
| 224 | 236 | { |
| 237 | + if ($key !== null && !\is_string($key)) { | |
| 238 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/psr7', '2.11', 'Passing %s to StreamInterface::getMetadata() is deprecated; guzzlehttp/psr7 3.0 requires string|null for $key.', \get_debug_type($key)); | |
| 239 | + } | |
| 225 | 240 | if (!isset($this->stream)) { |
| 226 | 241 | return $key ? null : []; |
| 227 | 242 | } elseif (!$key) { |
| 228 | 243 | return $this->customMetadata + \stream_get_meta_data($this->stream); |