createStreamFromResource($resource); } /** * @inheritdoc */ public function createStreamFromFile(string $file, string $mode = 'rb'): StreamInterface { $resource = fopen($file, $mode); if (! \is_resource($resource)) { throw new RuntimeException('Cannot create stream'); } return $this->createStreamFromResource($resource); } /** * @inheritdoc */ public function createStreamFromResource($resource): StreamInterface { return new Stream($resource); } }