Skip to content

Commit

Permalink
The Guzzle 7 is complaining about the stream_for method. It is deprec…
Browse files Browse the repository at this point in the history
…ated and they want to use Utils::streamFor instead
  • Loading branch information
dbclkh committed Jul 2, 2021
1 parent 57c5793 commit e231654
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/CacheEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/CacheMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())
);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
);
});
Expand Down

5 comments on commit e231654

@soulevilx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wonder when will this commit release :)

@dbclkh
Copy link
Contributor Author

@dbclkh dbclkh commented on e231654 Jul 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like @Kevinrob have done some testing and committing, the last couple of days.

Hopefully there will be a new release soon.

@Kevinrob
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dbclkh @jooservices Yes, we can release a new version. But I wonder if it's can be breaking? Should I tag it with a major version?

@dbclkh
Copy link
Contributor Author

@dbclkh dbclkh commented on e231654 Jul 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have time to test this with Guzzle 6, if it can run on Guzzle 6 & 7 - then I think it should be a minor version.

If it only runs on 7, then it should have a major version. This way you'll not be breaking anything for users with Guzzle 6.

@Kevinrob
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.