Skip to content

Commit 9401df1

Browse files
committed
Merge branch 'master' into use-multiphp-container
2 parents 0e57d72 + c69211b commit 9401df1

File tree

440 files changed

+12923
-3799
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

440 files changed

+12923
-3799
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ credentials.*
88
**/vendor/
99
**/build/
1010
.php_cs.cache
11+
.php-cs-fixer.cache
1112
.vscode/
1213
.kokoro/secrets.sh
1314
.phpunit.result.cache

.kokoro/secrets-example.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ export POSTGRES_DSN=
6060
export POSTGRES_DATABASE=
6161
export POSTGRES_USER=
6262
export POSTGRES_PASSWORD=
63+
export SQLSERVER_DSN=
64+
export SQLSERVER_DATABASE=
65+
export SQLSERVER_USER=
66+
export SQLSERVER_PASSWORD=
67+
export DB_SOCKET_DIR=
6368

6469
# Datastore
6570
export CLOUD_DATASTORE_NAMESPACE=

.kokoro/secrets.sh.enc

4 Bytes
Binary file not shown.

.php-cs-fixer.dist.php

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,42 @@
11
22

3-
return (new PhpCsFixer\Config())
3+
// php-cs-fixer 3.0 distributed config file
4+
5+
$config = new PhpCsFixer\Config();
6+
$config
47
->setRules([
58
'@PSR2' => true,
69
'concat_space' => ['spacing' => 'one'],
710
'no_unused_imports' => true,
8-
'method_argument_space' => false,
911
'whitespace_after_comma_in_array' => true,
1012
'method_argument_space' => [
11-
'keep_multiple_spaces_after_comma' => true, // for wordpress constants
12-
'on_multiline' => 'ignore', // consider removing this someday
13+
'keep_multiple_spaces_after_comma' => true,
14+
'on_multiline' => 'ignore'
1315
],
1416
'return_type_declaration' => [
1517
'space_before' => 'none'
1618
],
19+
// only converts simple strings in double quotes to single quotes
20+
// ignores strings using variables, escape characters or single quotes inside
21+
'single_quote' => true,
22+
// there should be a single space b/w the cast and it's operand
23+
'cast_spaces' => ['space' => 'single'],
24+
// there shouldn't be any trailing whitespace at the end of a non-blank line
25+
'no_trailing_whitespace' => true,
26+
// there shouldn't be any trailing whitespace at the end of a blank line
27+
'no_whitespace_in_blank_line' => true,
28+
// there should be a space around binary operators like (=, => etc)
29+
'binary_operator_spaces' => ['default' => 'single_space'],
30+
// deals with rogue empty blank lines
31+
'no_extra_blank_lines' => ['tokens' => ['extra']],
32+
// reduces multi blank lines b/w phpdoc description and @param to a single line
33+
// NOTE: Doesn't add a blank line if none exist
34+
'phpdoc_trim_consecutive_blank_line_separation' => true,
1735
])
1836
->setFinder(
1937
PhpCsFixer\Finder::create()
2038
->in(__DIR__)
2139
)
2240
;
41+
42+
return $config;

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
/firestore/**/*.php @GoogleCloudPlatform/cloud-native-db-dpes @GoogleCloudPlatform/php-admins
1616
/iot/ @gcseh @GoogleCloudPlatform/api-iot @GoogleCloudPlatform/php-admins
1717
/storage/ @GoogleCloudPlatform/storage-dpe @GoogleCloudPlatform/php-admins
18+
/spanner/ @GoogleCloudPlatform/api-spanner @GoogleCloudPlatform/php-admins
1819

1920

2021
# Functions samples owned by the Firebase team

CODE_OF_CONDUCT.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Contributor Code of Conduct
2+
3+
As contributors and maintainers of this project,
4+
and in the interest of fostering an open and welcoming community,
5+
we pledge to respect all people who contribute through reporting issues,
6+
posting feature requests, updating documentation,
7+
submitting pull requests or patches, and other activities.
8+
9+
We are committed to making participation in this project
10+
a harassment-free experience for everyone,
11+
regardless of level of experience, gender, gender identity and expression,
12+
sexual orientation, disability, personal appearance,
13+
body size, race, ethnicity, age, religion, or nationality.
14+
15+
Examples of unacceptable behavior by participants include:
16+
17+
* The use of sexualized language or imagery
18+
* Personal attacks
19+
* Trolling or insulting/derogatory comments
20+
* Public or private harassment
21+
* Publishing other's private information,
22+
such as physical or electronic
23+
addresses, without explicit permission
24+
* Other unethical or unprofessional conduct.
25+
26+
Project maintainers have the right and responsibility to remove, edit, or reject
27+
comments, commits, code, wiki edits, issues, and other contributions
28+
that are not aligned to this Code of Conduct.
29+
By adopting this Code of Conduct,
30+
project maintainers commit themselves to fairly and consistently
31+
applying these principles to every aspect of managing this project.
32+
Project maintainers who do not follow or enforce the Code of Conduct
33+
may be permanently removed from the project team.
34+
35+
This code of conduct applies both within project spaces and in public spaces
36+
when an individual is representing the project or its community.
37+
38+
Instances of abusive, harassing, or otherwise unacceptable behavior
39+
may be reported by opening an issue
40+
or contacting one or more of the project maintainers.
41+
42+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
43+
available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)

SECURITY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Security Policy
2+
3+
To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
4+
5+
The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
6+
7+
We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.

analyticsdata/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"require": {
3-
"google/analytics-data": "^0.5.0"
3+
"google/analytics-data": "^0.7.0"
44
}
55
}

analyticsdata/quickstart_json_credentials.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
*/
4444
$property_id = 'YOUR-GA4-PROPERTY-ID';
4545

46-
4746
// [START analyticsdata_json_credentials_initialize]
4847
/* TODO(developer): Replace this variable with a valid path to the
4948
* credentials.json file for your service account downloaded from the
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
3-
"google/analytics-data": "^0.5.0",
3+
"google/analytics-data": "^0.7.0",
44
"ext-bcmath": "*"
55
}
66
}

appengine/flexible/datastore/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
$entity['user_ip']);
7373
}
7474
# [END gae_flex_datastore_query]
75-
array_unshift($visits, "Last 10 visits:");
75+
array_unshift($visits, 'Last 10 visits:');
7676
$response->getBody()->write(implode("\n", $visits));
7777

7878
return $response

appengine/flexible/datastore/test/DeployTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ public function testIndex()
3030
$this->assertEquals('200', $resp->getStatusCode(),
3131
'top page status code');
3232

33-
$this->assertStringContainsString("Last 10 visits:", (string) $resp->getBody());
33+
$this->assertStringContainsString('Last 10 visits:', (string) $resp->getBody());
3434
}
3535
}

appengine/flexible/datastore/test/LocalTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ public function testIndex()
3333
$response = $app->handle($request);
3434
$this->assertEquals(200, $response->getStatusCode());
3535
$text = (string) $response->getBody();
36-
$this->assertStringContainsString("Last 10 visits:", $text);
36+
$this->assertStringContainsString('Last 10 visits:', $text);
3737
}
3838
}

appengine/flexible/logging/test/DeployTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function testIndex()
4141
$this->assertEquals('200', $resp->getStatusCode(),
4242
'top page status code');
4343

44-
$this->assertStringContainsString("Logs:", (string) $resp->getBody());
44+
$this->assertStringContainsString('Logs:', (string) $resp->getBody());
4545
}
4646
public function testAsyncLog()
4747
{

appengine/flexible/logging/test/LocalTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testSomeLogs()
3333

3434
$this->assertEquals(200, $response->getStatusCode());
3535
$text = (string) $response->getBody();
36-
$this->assertStringContainsString("Logs:", $text);
36+
$this->assertStringContainsString('Logs:', $text);
3737
}
3838

3939
public function testAsyncLog()

appengine/flexible/memcache/test/DeployTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ public function testIndex()
5050
$key = rand(0, 1000);
5151

5252
// Test the /memcached REST API.
53-
$this->put("/memcached/test$key", "sour");
54-
$this->assertEquals("sour", $this->get("/memcached/test$key"));
55-
$this->put("/memcached/test$key", "sweet");
56-
$this->assertEquals("sweet", $this->get("/memcached/test$key"));
53+
$this->put("/memcached/test$key", 'sour');
54+
$this->assertEquals('sour', $this->get("/memcached/test$key"));
55+
$this->put("/memcached/test$key", 'sweet');
56+
$this->assertEquals('sweet', $this->get("/memcached/test$key"));
5757

5858
// Make sure it handles a POST request too, which will increment the
5959
// counter.

appengine/flexible/memcache/test/LocalTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,26 +62,26 @@ public function testGetAndPut()
6262
// Use a random key to avoid colliding with simultaneous tests.
6363

6464
// Test the /memcached REST API.
65-
$request1 = (new RequestFactory)->createRequest('PUT', "/memcached/testkey1");
65+
$request1 = (new RequestFactory)->createRequest('PUT', '/memcached/testkey1');
6666
$request1->getBody()->write('sour');
6767
$response1 = $app->handle($request1);
6868
$this->assertEquals(200, (string) $response1->getStatusCode());
6969

7070
// Check that the key was written as expected
71-
$request2 = (new RequestFactory)->createRequest('GET', "/memcached/testkey1");
71+
$request2 = (new RequestFactory)->createRequest('GET', '/memcached/testkey1');
7272
$response2 = $app->handle($request2);
73-
$this->assertEquals("sour", (string) $response2->getBody());
73+
$this->assertEquals('sour', (string) $response2->getBody());
7474

7575
// Test the /memcached REST API with a new value.
76-
$request3 = (new RequestFactory)->createRequest('PUT', "/memcached/testkey2");
76+
$request3 = (new RequestFactory)->createRequest('PUT', '/memcached/testkey2');
7777
$request3->getBody()->write('sweet');
7878
$response3 = $app->handle($request3);
7979
$this->assertEquals(200, (string) $response3->getStatusCode());
8080

8181
// Check that the key was written as expected
82-
$request4 = (new RequestFactory)->createRequest('GET', "/memcached/testkey2");
82+
$request4 = (new RequestFactory)->createRequest('GET', '/memcached/testkey2');
8383
$response4 = $app->handle($request4);
84-
$this->assertEquals("sweet", (string) $response4->getBody());
84+
$this->assertEquals('sweet', (string) $response4->getBody());
8585
}
8686
}
8787

appengine/flexible/twilio/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
$app->addErrorMiddleware(true, true, true);
2929

3030
$twilioAccountSid = getenv('TWILIO_ACCOUNT_SID');
31-
$twilioAuthToken = getenv('TWILIO_AUTH_TOKEN');
31+
$twilioAuthToken = getenv('TWILIO_AUTH_TOKEN');
3232
$twilioNumber = getenv('TWILIO_FROM_NUMBER');
3333

3434
# [START gae_flex_twilio_receive_call]

appengine/flexible/websockets/socket-demo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function onOpen(ConnectionInterface $conn)
4242

4343
public function onMessage(ConnectionInterface $from, $msg)
4444
{
45-
$output = "Message received: " . $msg . "\n";
45+
$output = 'Message received: ' . $msg . "\n";
4646
echo $output;
4747
foreach ($this->clients as $client) {
4848
$client->send($output);
@@ -59,7 +59,7 @@ public function onClose(ConnectionInterface $conn)
5959
public function onError(ConnectionInterface $conn, \Exception $e)
6060
{
6161
$conn->close();
62-
echo "Connection closed due to error: " . $e->getMessage() . "\n";
62+
echo 'Connection closed due to error: ' . $e->getMessage() . "\n";
6363
echo "\t" . $this->clients->count() . " connection(s) active.\n";
6464
}
6565
}

appengine/flexible/websockets/test/LocalTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ public function testIndex()
5454
return $endPromise;
5555
})
5656
->otherwise(function ($e) {
57-
echo "Error: " . $e->getMessage() . "\n";
57+
echo 'Error: ' . $e->getMessage() . "\n";
5858
throw $e;
5959
});
6060

6161
$this->loop->run();
6262
$resolvedMsg = Block\await($basePromise, $this->loop);
6363
$this->assertStringContainsString(
64-
"Message received: Hello World!",
64+
'Message received: Hello World!',
6565
strval($resolvedMsg)
6666
);
6767
}

appengine/flexible/wordpress/files/wp-config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
* You can have multiple installations in one database if you give each
9898
* a unique prefix. Only numbers, letters, and underscores please!
9999
*/
100-
$table_prefix = 'wp_';
100+
$table_prefix = 'wp_';
101101

102102
/**
103103
* For developers: WordPress debugging mode.

appengine/standard/errorreporting/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function throwException()
4343
print('Triggering a PHP Fatal Error by including a file with a syntax error.');
4444
print($linkText);
4545
$filename = tempnam(sys_get_temp_dir(), 'php_syntax_error');
46-
file_put_contents($filename, "");
46+
file_put_contents($filename, '');
4747
require($filename);
4848
break;
4949
default:

appengine/standard/getting-started/test/CloudSqlTest.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,31 @@
1717
namespace Google\Cloud\Test\GettingStarted;
1818

1919
use Google\Cloud\TestUtils\TestTrait;
20+
use Google\Cloud\TestUtils\CloudSqlProxyTrait;
2021
use Google\Cloud\Samples\AppEngine\GettingStarted\CloudSqlDataModel;
2122
use PHPUnit\Framework\TestCase;
2223
use PDO;
2324

2425
class CloudSqlTest extends TestCase
2526
{
2627
use TestTrait;
28+
use CloudSqlProxyTrait;
2729

2830
public function setUp(): void
2931
{
3032
$connection = $this->requireEnv('CLOUDSQL_CONNECTION_NAME');
33+
$socketDir = $this->requireEnv('DB_SOCKET_DIR');
34+
35+
$this->startCloudSqlProxy($connection, $socketDir);
36+
3137
$dbUser = $this->requireEnv('CLOUDSQL_USER');
3238
$dbPass = $this->requireEnv('CLOUDSQL_PASSWORD');
3339
$dbName = getenv('CLOUDSQL_DATABASE_NAME') ?: 'bookshelf';
34-
$socket = "/tmp/cloudsql/${connection}";
40+
$socket = "${socketDir}/${connection}";
3541

3642
if (!file_exists($socket)) {
3743
$this->markTestSkipped(
38-
"You must run 'cloud_sql_proxy -instances=${connection} -dir=/cloudsql'"
44+
"You must run 'cloud_sql_proxy -instances=${connection} -dir=${socketDir}'"
3945
);
4046
}
4147
$dsn = "mysql:unix_socket=${socket};dbname=${dbName}";
@@ -144,11 +150,11 @@ public function testDataModel()
144150

145151
// Clean up.
146152
$result = $model->delete($breakfastId);
147-
$this->assertTrue((bool)$result);
153+
$this->assertTrue((bool) $result);
148154
$this->assertFalse($model->read($breakfastId));
149-
$this->assertTrue((bool)$model->read($bellId));
155+
$this->assertTrue((bool) $model->read($bellId));
150156
$result = $model->delete($bellId);
151-
$this->assertTrue((bool)$result);
157+
$this->assertTrue((bool) $result);
152158
$this->assertFalse($model->read($bellId));
153159
}
154160
}

appengine/standard/grpc/monitoring.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
$r = new MonitoredResource();
4242
$r->setType('gce_instance');
4343
$r->setLabels([
44-
'instance_id' =>$instanceId,
44+
'instance_id' => $instanceId,
4545
'zone' => 'us-central1-f',
4646
]);
4747

appengine/standard/grpc/speech.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
$strm->write($strmReq);
4848

4949
$strmReq = new StreamingRecognizeRequest();
50-
$f = fopen($audioFile, "rb");
50+
$f = fopen($audioFile, 'rb');
5151
$fsize = filesize($audioFile);
5252
$bytes = fread($f, $fsize);
5353
$strmReq->setAudioContent($bytes);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
22

3-
echo "hello world!";
3+
echo 'hello world!';

0 commit comments

Comments
 (0)