From 8250c918b9677bce495539b76f9f641d4bdd1a64 Mon Sep 17 00:00:00 2001 From: lewzylu <327874225@qq.com> Date: Wed, 6 Jan 2021 16:31:03 +0800 Subject: [PATCH 1/3] Feature guzzle7 (#175) * update to guzzle7 * update travis Co-authored-by: lewzylu --- .travis.yml | 2 +- composer.json | 6 +++--- src/Qcloud/Cos/Client.php | 2 +- src/Qcloud/Cos/Tests/COSTest.php | 6 ++---- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1dfbb818..82479e7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: php php: - - 5.6 + - 7.3 notifications: email: recipients: diff --git a/composer.json b/composer.json index 6eecca14..f9087db1 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,8 @@ } }, "require": { - "php": ">=5.3.0", - "guzzlehttp/guzzle": "~6.3", - "guzzlehttp/guzzle-services": "~1.1" + "php": ">=7.3", + "guzzlehttp/guzzle": "^7.0.1", + "guzzlehttp/guzzle-services": "~1.2" } } diff --git a/src/Qcloud/Cos/Client.php b/src/Qcloud/Cos/Client.php index 77d94bc6..8ca34a45 100644 --- a/src/Qcloud/Cos/Client.php +++ b/src/Qcloud/Cos/Client.php @@ -75,7 +75,7 @@ * @method object SelectObjectContent (array $arg) */ class Client extends GuzzleClient { - const VERSION = '2.1.2'; + const VERSION = '3.0.0'; public $httpClient; diff --git a/src/Qcloud/Cos/Tests/COSTest.php b/src/Qcloud/Cos/Tests/COSTest.php index b02b82f6..3e038202 100644 --- a/src/Qcloud/Cos/Tests/COSTest.php +++ b/src/Qcloud/Cos/Tests/COSTest.php @@ -10,8 +10,7 @@ class COSTest extends \PHPUnit\Framework\TestCase private $cosClient; private $bucket; private $region; - protected function setUp() - { + protected function setUp(): void { $this->bucket = getenv('COS_BUCKET'); $this->region = getenv('COS_REGION'); $this->bucket2 = "tmp".$this->bucket; @@ -25,7 +24,7 @@ protected function setUp() } } - protected function tearDown() { + protected function tearDown(): void { } function generateRandomString($length = 10) { @@ -718,7 +717,6 @@ public function testGetBucketCorsNull() 'Bucket' => $this->bucket ) ); - print_r($rt); $this->assertTrue(False); } catch (ServiceResponseException $e) { $this->assertTrue($e->getExceptionCode() === 'NoSuchCORSConfiguration' && $e->getStatusCode() === 404); From bea61151ef21d644056c50044780df91682b9116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tuunalai=EF=BC=88=E8=B5=96=E6=9D=B0=EF=BC=89?= <9778380+tuuna@users.noreply.github.com> Date: Sat, 21 Aug 2021 17:10:39 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=AD=A3guzzle=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f9087db1..18d5deb3 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ }, "require": { "php": ">=7.3", - "guzzlehttp/guzzle": "^7.0.1", + "guzzlehttp/guzzle": "~7.0.1", "guzzlehttp/guzzle-services": "~1.2" } } From 7a224f8dad66ce5076fe11768df035e12f189c87 Mon Sep 17 00:00:00 2001 From: tuuna <550566181@qq.com> Date: Wed, 1 Sep 2021 11:31:31 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dguzzle7.3=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E8=BF=87=E6=9C=9F=E9=97=AE=E9=A2=98=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81laravel8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- src/Qcloud/Cos/Client.php | 4 ++-- src/Qcloud/Cos/Request/BodyLocation.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 18d5deb3..f9087db1 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ }, "require": { "php": ">=7.3", - "guzzlehttp/guzzle": "~7.0.1", + "guzzlehttp/guzzle": "^7.0.1", "guzzlehttp/guzzle-services": "~1.2" } } diff --git a/src/Qcloud/Cos/Client.php b/src/Qcloud/Cos/Client.php index 8ca34a45..0f3d3f2f 100644 --- a/src/Qcloud/Cos/Client.php +++ b/src/Qcloud/Cos/Client.php @@ -212,7 +212,7 @@ public function getObjectUrl($bucket, $key, $expires = "+30 minutes", array $arg } public function upload($bucket, $key, $body, $options = array()) { - $body = Psr7\stream_for($body); + $body = Psr7\Utils::streamFor($body); $options['PartSize'] = isset($options['PartSize']) ? $options['PartSize'] : MultipartUpload::DEFAULT_PART_SIZE; if ($body->getSize() < $options['PartSize']) { $rt = $this->putObject(array( @@ -233,7 +233,7 @@ public function upload($bucket, $key, $body, $options = array()) { } public function resumeUpload($bucket, $key, $body, $uploadId, $options = array()) { - $body = Psr7\stream_for($body); + $body = Psr7\Utils::streamFor($body); $options['PartSize'] = isset($options['PartSize']) ? $options['PartSize'] : MultipartUpload::DEFAULT_PART_SIZE; $multipartUpload = new MultipartUpload($this, $body, array( 'Bucket' => $bucket, diff --git a/src/Qcloud/Cos/Request/BodyLocation.php b/src/Qcloud/Cos/Request/BodyLocation.php index 90f97a54..73787fd5 100644 --- a/src/Qcloud/Cos/Request/BodyLocation.php +++ b/src/Qcloud/Cos/Request/BodyLocation.php @@ -44,6 +44,6 @@ public function visit( } // binary string data from bound parameter $value = $command[$param->getName()]; - return $request->withBody(Psr7\stream_for($value)); + return $request->withBody(Psr7\Utils::streamFor($value)); } }