From e2316543cc56e84b6d46290e8b989dc368f1d7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Krogsg=C3=A5rd=20Hansen?= Date: Fri, 2 Jul 2021 08:33:10 +0200 Subject: [PATCH] The Guzzle 7 is complaining about the stream_for method. It is deprecated and they want to use Utils::streamFor instead --- src/CacheEntry.php | 2 +- src/CacheMiddleware.php | 2 +- tests/BaseTest.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CacheEntry.php b/src/CacheEntry.php index 50654d68..dc5a8c20 100644 --- a/src/CacheEntry.php +++ b/src/CacheEntry.php @@ -280,7 +280,7 @@ public function __wakeup() if ($this->response !== null) { $this->response = $this->response ->withBody( - \GuzzleHttp\Psr7\stream_for($this->responseBody) + \GuzzleHttp\Psr7\Utils::streamFor($this->responseBody) ); } } diff --git a/src/CacheMiddleware.php b/src/CacheMiddleware.php index b620102f..0f6ea2a6 100644 --- a/src/CacheMiddleware.php +++ b/src/CacheMiddleware.php @@ -255,7 +255,7 @@ protected static function addToCache( // If the body is not seekable, we have to replace it by a seekable one if (!$response->getBody()->isSeekable()) { $response = $response->withBody( - \GuzzleHttp\Psr7\stream_for($response->getBody()->getContents()) + \GuzzleHttp\Psr7\Utils::streamFor($response->getBody()->getContents()) ); } diff --git a/tests/BaseTest.php b/tests/BaseTest.php index b947a51b..25b4a238 100644 --- a/tests/BaseTest.php +++ b/tests/BaseTest.php @@ -25,14 +25,14 @@ protected function setUp() if ($request->getUri()->getPath() === '/no-seek') { return new FulfilledPromise( (new Response()) - ->withBody(new NoSeekStream(\GuzzleHttp\Psr7\stream_for('I am not seekable!'))) + ->withBody(new NoSeekStream(\GuzzleHttp\Psr7\Utils::streamFor('I am not seekable!'))) ->withHeader('Expires', gmdate('D, d M Y H:i:s T', time() + 120)) ); } return new FulfilledPromise( (new Response()) - ->withBody(\GuzzleHttp\Psr7\stream_for('Hello world!')) + ->withBody(\GuzzleHttp\Psr7\Utils::streamFor('Hello world!')) ->withHeader('Expires', gmdate('D, d M Y H:i:s T', time() + 120)) ); });