wp-includes/php-ai-client/third-party/Nyholm/Psr7/Stream.php:14$streamresource|nullprivate$seekableboolprivate$readableboolprivate$writableboolprivate$uriarray|mixed|void|bool|nullprivate$sizeint|nullprivateclass Stream implements StreamInterface{ use StreamTrait; /** @var resource|null A resource reference */ private $stream; /** @var bool */ private $seekable; /** @var bool */ private $readable; /** @var bool */ private $writable; /** @var array|mixed|void|bool|null */ private $uri; /** @var int|null */ private $size; /** @var array Hash of readable and writable stream types */ private const READ_WRITE_HASH = ['read' => ['r' => \true, 'w+' => \true, 'r+' => \true, 'x+' => \true, 'c+' => \true, 'rb' => \true, 'w+b' => \true, 'r+b' => \true, 'x+b' => \true, 'c+b' => \true, 'rt' => \true, 'w+t' => \true, 'r+t' => \true, 'x+t' => \true, 'c+t' => \true, 'a+' => \true], 'write' => ['w' => \true, 'w+' => \true, 'rw' => \true, 'r+' => \true, 'x+' => \true, 'c+' => \true, 'wb' => \true, 'w+b' => \true, 'r+b' => \true, 'x+b' => \true, 'c+b' => \true, 'w+t' => \true, 'r+t' => \true, 'x+t' => \true, 'c+t' => \true, 'a' => \true, 'a+' => \true]]; /** * @param resource $body */ public function __construct($body) { if (!\is_resource($body)) { throw new \InvalidArgumentException('First argument to Stream::__construct() must be resource'); } $this->stream = $body; $meta = \stream_get_meta_data($this->stream); $this->seekable = $meta['seekable'] && 0 === \fseek($this->stream, 0, \SEEK_CUR); $this->readable = isset(self::READ_WRITE_HASH['read'][$meta['mode']]); $this->writable = isset(self::READ_WRITE_HASH['write'][$meta['mode']]); } /** * Creates a new PSR-7 stream. * * @param string|resource|StreamInterface $body * * @throws \InvalidArgumentException */ public static function create($body = ''): StreamInterface { if ($body instanceof StreamInterface) { return $body; } if (\is_string($body)) { if (200000 <= \strlen($body)) { $body = self::openZvalStream($body); } else { $resource = \fopen('php://memory', 'r+'); \fwrite($resource, $body); \fseek($resource, 0); $body = $resource; } } if (!\is_resource($body)) { throw new \InvalidArgumentException('First argument to Stream::create() must be a string, resource or StreamInterface'); } return new self($body); } /** * Closes the stream when the destructed. */ public function __destruct() { $this->close(); } public function close(): void { if (isset($this->stream)) { if (\is_resource($this->stream)) { \fclose($this->stream); } $this->detach(); } } public function detach() { if (!isset($this->stream)) { return null; } $result = $this->stream;Unchanged from 7.0.4 through 7.1.0.
Signature, return type and hooks compared across 2 parsed releases.
src/wp-includes/php-ai-client/third-party/Nyholm/Psr7/Stream.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.