Skip to content

Commit 0727e07

Browse files
committed
cleanup from code review and tests
1 parent 7992b4f commit 0727e07

8 files changed

Lines changed: 37 additions & 70 deletions

File tree

Core/src/LongRunning/LongRunningClientConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright 2016 Google Inc.
3+
* Copyright 2025 Google Inc.
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.

Core/src/LongRunning/LongRunningOperation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public function reload(array $options = [])
254254
$this->result = null;
255255
$this->error = null;
256256

257-
if (isset($res['done']) && $res['done'] && isset($res['metadata']['typeUrl'])) {
257+
if ($res['done'] ?? false && isset($res['metadata']['typeUrl'])) {
258258
$type = $res['metadata']['typeUrl'];
259259
$this->result = $this->executeDoneCallback($type, $res['response']);
260260
$this->error = $res['error'] ?? null;

Core/src/TimeTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private function formatTimeAsString(\DateTimeInterface $dateTime, $ns)
7777
$dateTime = clone $dateTime;
7878
}
7979
$dateTime = $dateTime->setTimeZone(new \DateTimeZone('UTC'));
80-
if ($ns === null) {
80+
if (is_null($ns)) {
8181
return $dateTime->format(Timestamp::FORMAT);
8282
} else {
8383
return sprintf(

Core/tests/Unit/ApiHelperTraitTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,10 @@ public function testValidateOptionsCustomSerializer($options, $optionTypes, $exp
286286
$numMessages = count(array_filter($expected, fn ($optionType) => $optionType instanceof Message));
287287
$serializer = $this->prophesize(Serializer::class);
288288
$serializer->decodeMessage(Argument::type(Message::class), Argument::type('array'))
289-
->shouldBeCalledTimes($numMessages)
290-
->will(function ($args) {
289+
->shouldBeCalledTimes($numMessages)
290+
->will(function ($args) {
291291
return (new Serializer())->decodeMessage($args[0], $args[1]);
292-
});
292+
});
293293

294294
// test using an implementation with custom serializer
295295
$implementation = new ApiHelpersTraitImpl();

Spanner/composer.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,5 @@
4444
"Testing\\Data\\": "tests/data/generated/Testing/Data",
4545
"GPBMetadata\\Data\\": "tests/data/generated/GPBMetadata/Data"
4646
}
47-
},
48-
"repositories": {
49-
"google-cloud": {
50-
"type": "path",
51-
"url": "../Core",
52-
"options": {
53-
"versions": {
54-
"google/cloud-core": "1.60"
55-
}
56-
}
57-
}
5847
}
5948
}

Spanner/src/Middleware/SpannerMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* Copyright 2024 Google LLC
3+
* Copyright 2025 Google LLC
44
* All rights reserved.
55
*
66
* Redistribution and use in source and binary forms, with or without

Spanner/src/Serializer.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,34 @@
11
<?php
2+
/*
3+
* Copyright 2025 Google LLC
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are
8+
* met:
9+
*
10+
* * Redistributions of source code must retain the above copyright
11+
* notice, this list of conditions and the following disclaimer.
12+
* * Redistributions in binary form must reproduce the above
13+
* copyright notice, this list of conditions and the following disclaimer
14+
* in the documentation and/or other materials provided with the
15+
* distribution.
16+
* * Neither the name of Google Inc. nor the names of its
17+
* contributors may be used to endorse or promote products derived from
18+
* this software without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
*/
232

333
namespace Google\Cloud\Spanner;
434

Spanner/src/V1/SpannerClient.php

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)