Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Upgrade Guzzlehttp/psr7 version #4508

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions BigQuery/src/Bytes.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace Google\Cloud\BigQuery;

use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Utils;
use Psr\Http\Message\StreamInterface;

/**
Expand Down Expand Up @@ -45,7 +45,7 @@ class Bytes implements ValueInterface
*/
public function __construct($value)
{
$this->value = Psr7\stream_for($value);
$this->value = Utils::streamFor($value);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions BigQuery/src/Connection/Rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use Google\Cloud\Core\Upload\AbstractUploader;
use Google\Cloud\Core\Upload\MultipartUploader;
use Google\Cloud\Core\UriTrait;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Utils;

/**
* Implementation of the
Expand Down Expand Up @@ -280,7 +280,7 @@ private function resolveUploadOptions(array $args)
'jobReference' => []
];

$args['data'] = Psr7\stream_for($args['data']);
$args['data'] = Utils::streamFor($args['data']);
$args['metadata'] = $this->pluckArray([
'labels',
'dryRun',
Expand Down
4 changes: 2 additions & 2 deletions BigQuery/tests/System/LoadDataAndQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Google\Cloud\BigQuery\Geography;
use Google\Cloud\BigQuery\Numeric;
use Google\Cloud\Core\ExponentialBackoff;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Utils;

/**
* @group bigquery
Expand Down Expand Up @@ -408,7 +408,7 @@ public function rowProvider()
return [
[$data],
[fopen(__DIR__ . '/data/table-data.json', 'r')],
[Psr7\stream_for($data)]
[Utils::streamFor($data)]
];
}

Expand Down
4 changes: 2 additions & 2 deletions BigQuery/tests/Unit/BytesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace Google\Cloud\BigQuery\Tests\Unit;

use Google\Cloud\BigQuery\Bytes;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Utils;
use PHPUnit\Framework\TestCase;

/**
Expand Down Expand Up @@ -47,7 +47,7 @@ public function valueProvider()
return [
[$this->value],
[$fh],
[Psr7\stream_for($this->value)]
[Utils::streamFor($this->value)]
];
}

Expand Down
1 change: 0 additions & 1 deletion BigQuery/tests/Unit/Connection/RestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use Google\Cloud\Core\RequestWrapper;
use Google\Cloud\Core\Testing\TestHelpers;
use Google\Cloud\Core\Upload\AbstractUploader;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
Expand Down
2 changes: 1 addition & 1 deletion Core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"google/auth": "^1.12",
"guzzlehttp/guzzle": "^5.3|^6.0|^7.0",
"guzzlehttp/promises": "^1.3",
"guzzlehttp/psr7": "^1.2",
"guzzlehttp/psr7": "^1.7|^2.0",
"monolog/monolog": "^1.1|^2.0",
"psr/http-message": "1.0.*"
},
Expand Down
4 changes: 2 additions & 2 deletions Core/src/Blob.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace Google\Cloud\Core;

use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Utils;
use Psr\Http\Message\StreamInterface;

/**
Expand Down Expand Up @@ -52,7 +52,7 @@ class Blob
*/
public function __construct($value)
{
$this->value = Psr7\stream_for($value);
$this->value = Utils::streamFor($value);
}

/**
Expand Down
1 change: 0 additions & 1 deletion Core/src/RequestBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

namespace Google\Cloud\Core;

use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Uri;
use Psr\Http\Message\RequestInterface;
Expand Down
4 changes: 2 additions & 2 deletions Core/src/RequestWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
use Google\Cloud\Core\RequestWrapperTrait;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Utils;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
Expand Down Expand Up @@ -304,7 +304,7 @@ private function applyHeaders(RequestInterface $request)
}
}

return Psr7\modify_request($request, ['set_headers' => $headers]);
return Utils::modifyRequest($request, ['set_headers' => $headers]);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Core/src/Upload/AbstractUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

use Google\Cloud\Core\RequestWrapper;
use Google\Cloud\Core\UriTrait;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Utils;
use Psr\Http\Message\StreamInterface;

/**
Expand Down Expand Up @@ -96,7 +96,7 @@ public function __construct(
array $options = []
) {
$this->requestWrapper = $requestWrapper;
$this->data = Psr7\stream_for($data);
$this->data = Utils::streamFor($data);
$this->uri = $uri;
$this->metadata = isset($options['metadata']) ? $options['metadata'] : [];
$this->chunkSize = isset($options['chunkSize']) ? $options['chunkSize'] : null;
Expand Down
1 change: 0 additions & 1 deletion Core/src/Upload/ResumableUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use Google\Cloud\Core\JsonTrait;
use Google\Cloud\Core\RequestWrapper;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\LimitStream;
use GuzzleHttp\Psr7\Request;
use Psr\Http\Message\ResponseInterface;
Expand Down
5 changes: 3 additions & 2 deletions Core/src/UriTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

namespace Google\Cloud\Core;

use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Query;
use GuzzleHttp\Psr7\Utils;
use Psr\Http\Message\UriInterface;
use Rize\UriTemplate;

Expand Down Expand Up @@ -59,6 +60,6 @@ public function buildUriWithQuery($uri, array $query)
}
}

return Psr7\uri_for($uri)->withQuery(Psr7\build_query($query));
return Utils::uriFor($uri)->withQuery(Query::build($query));
}
}
7 changes: 3 additions & 4 deletions Core/tests/Unit/Upload/MultipartUploaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
use Google\Cloud\Core\RequestWrapper;
use Google\Cloud\Core\Upload\MultipartUploader;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Promise;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Psr7\Utils;
use Prophecy\Argument;
use Psr\Http\Message\RequestInterface;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\StreamInterface;

/**
* @group core
Expand All @@ -38,7 +37,7 @@ class MultipartUploaderTest extends TestCase
public function testUploadsData()
{
$requestWrapper = $this->prophesize(RequestWrapper::class);
$stream = Psr7\stream_for('abcd');
$stream = Utils::streamFor('abcd');
$successBody = '{"canI":"kickIt"}';
$response = new Response(200, [], $successBody);

Expand All @@ -59,7 +58,7 @@ public function testUploadsData()
public function testUploadsAsyncData()
{
$requestWrapper = $this->prophesize(RequestWrapper::class);
$stream = Psr7\stream_for('abcd');
$stream = Utils::streamFor('abcd');
$successBody = '{"canI":"kickIt"}';
$response = new Response(200, [], $successBody);
$promise = Promise\promise_for($response);
Expand Down
5 changes: 2 additions & 3 deletions Core/tests/Unit/Upload/ResumableUploaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
use Google\Cloud\Core\Exception\GoogleException;
use Google\Cloud\Core\RequestWrapper;
use Google\Cloud\Core\Upload\ResumableUploader;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Psr7\Utils;
use Prophecy\Argument;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\StreamInterface;
Expand All @@ -41,7 +40,7 @@ class ResumableUploaderTest extends TestCase
public function setUp()
{
$this->requestWrapper = $this->prophesize(RequestWrapper::class);
$this->stream = Psr7\stream_for('abcd');
$this->stream = Utils::streamFor('abcd');
$this->successBody = '{"canI":"kickIt"}';
}

Expand Down
5 changes: 2 additions & 3 deletions Core/tests/Unit/Upload/SignedUrlUploaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
use Google\Cloud\Core\Exception\GoogleException;
use Google\Cloud\Core\RequestWrapper;
use Google\Cloud\Core\Upload\SignedUrlUploader;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Psr7\Utils;
use Prophecy\Argument;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\StreamInterface;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -41,7 +40,7 @@ class SignedUrlUploaderTest extends TestCase
public function setUp()
{
$this->requestWrapper = $this->prophesize(RequestWrapper::class);
$this->stream = Psr7\stream_for('abcd');
$this->stream = Utils::streamFor('abcd');
$this->successBody = '{"canI":"kickIt"}';
}

Expand Down
2 changes: 0 additions & 2 deletions Datastore/src/Blob.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
namespace Google\Cloud\Datastore;

use Google\Cloud\Core\Blob as CoreBlob;
use GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;

/**
* Represents a Blob value.
Expand Down
4 changes: 2 additions & 2 deletions Datastore/tests/Unit/BlobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace Google\Cloud\Datastore\Tests\Unit;

use Google\Cloud\Datastore\Blob;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Utils;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -45,7 +45,7 @@ public function testBlobResource()

public function testBlobStreamInterface()
{
$blob = new Blob(Psr7\stream_for('hello world'));
$blob = new Blob(Utils::streamFor('hello world'));
$this->assertEquals('hello world', (string) $blob);
}

Expand Down
1 change: 0 additions & 1 deletion Datastore/tests/Unit/Connection/RestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Google\Cloud\Core\RequestWrapper;
use Google\Cloud\Core\Testing\TestHelpers;
use Google\Cloud\Datastore\Connection\Rest;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
Expand Down
1 change: 0 additions & 1 deletion Datastore/tests/Unit/EntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Google\Cloud\Datastore\Entity;
use Google\Cloud\Datastore\EntityMapper;
use Google\Cloud\Datastore\Key;
use GuzzleHttp\Psr7\Stream;
use PHPUnit\Framework\TestCase;

/**
Expand Down
1 change: 0 additions & 1 deletion Language/tests/Unit/Connection/RestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Google\Cloud\Core\RequestWrapper;
use Google\Cloud\Core\Testing\TestHelpers;
use Google\Cloud\Language\Connection\Rest;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
Expand Down
1 change: 0 additions & 1 deletion Logging/tests/Unit/Connection/RestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Google\Cloud\Core\RequestWrapper;
use Google\Cloud\Core\Testing\TestHelpers;
use Google\Cloud\Logging\Connection\Rest;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
Expand Down
1 change: 0 additions & 1 deletion PubSub/tests/Unit/Connection/RestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Google\Cloud\Core\RequestWrapper;
use Google\Cloud\Core\Testing\TestHelpers;
use Google\Cloud\PubSub\Connection\Rest;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
Expand Down
4 changes: 2 additions & 2 deletions Spanner/src/Bytes.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace Google\Cloud\Spanner;

use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Utils;
use Psr\Http\Message\StreamInterface;

/**
Expand Down Expand Up @@ -50,7 +50,7 @@ class Bytes implements ValueInterface
*/
public function __construct($value)
{
$this->value = Psr7\stream_for($value);
$this->value = Utils::streamFor($value);
}

/**
Expand Down
1 change: 0 additions & 1 deletion Speech/tests/Unit/Connection/RestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Google\Cloud\Core\RequestWrapper;
use Google\Cloud\Core\Testing\TestHelpers;
use Google\Cloud\Speech\Connection\Rest;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;
Expand Down
7 changes: 4 additions & 3 deletions Storage/src/Bucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
use Google\Cloud\Storage\Connection\IamBucket;
use Google\Cloud\Storage\SigningHelper;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\MimeType;
use GuzzleHttp\Psr7\Utils;
use Psr\Http\Message\StreamInterface;

/**
Expand Down Expand Up @@ -1070,7 +1071,7 @@ public function compose(array $sourceObjects, $name, array $options = [])
];

if (!isset($options['destination']['contentType'])) {
$options['destination']['contentType'] = Psr7\mimetype_from_filename($name);
$options['destination']['contentType'] = MimeType::fromFilename($name);
}

if ($options['destination']['contentType'] === null) {
Expand Down Expand Up @@ -1266,7 +1267,7 @@ public function isWritable($file = null)
{
$file = $file ?: '__tempfile';
$uploader = $this->getResumableUploader(
Psr7\stream_for(''),
Utils::streamFor(''),
['name' => $file]
);
try {
Expand Down
Loading