Skip to content

Commit 2ae887a

Browse files
authored
feat: configure typehints, better documentation, refactor tests (#151)
1 parent fe51dc2 commit 2ae887a

38 files changed

+426
-134
lines changed

src/Fixers/ClientUpgradeFixer/examples/legacy_class_vars.php renamed to examples/class_vars.legacy.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// new client surface won't exist (not a generator client)
1414
use Google\Cloud\Storage\StorageClient;
1515

16-
class ClientWrapper extends TestCase
16+
class ClientWrapper
1717
{
1818
public $dlp;
1919
public $secretmanager;
@@ -33,6 +33,11 @@ public function callSecretManager()
3333
{
3434
$secrets = $this->secretmanager->listSecrets('this/is/a/parent');
3535
}
36+
37+
public function callDlpFromFunction(DlpServiceClient $client)
38+
{
39+
$infoTypes = $client->listInfoTypes();
40+
}
3641
}
3742

3843
// Instantiate a wrapping object.

src/Fixers/ClientUpgradeFixer/examples/new_class_vars.php renamed to examples/class_vars.new.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Google\Cloud\SecretManager\V1\ListSecretsRequest;
1616
use Google\Cloud\Storage\StorageClient;
1717

18-
class ClientWrapper extends TestCase
18+
class ClientWrapper
1919
{
2020
public $dlp;
2121
public $secretmanager;
@@ -38,14 +38,20 @@ public function callSecretManager()
3838
->setParent('this/is/a/parent');
3939
$secrets = $this->secretmanager->listSecrets($listSecretsRequest);
4040
}
41+
42+
public function callDlpFromFunction(DlpServiceClient $client)
43+
{
44+
$listInfoTypesRequest2 = new ListInfoTypesRequest();
45+
$infoTypes = $client->listInfoTypes($listInfoTypesRequest2);
46+
}
4147
}
4248

4349
// Instantiate a wrapping object.
4450
$wrapper = new ClientWrapper();
4551

4652
// these should update
47-
$listInfoTypesRequest2 = new ListInfoTypesRequest();
48-
$infoTypes = $wrapper->dlp->listInfoTypes($listInfoTypesRequest2);
53+
$listInfoTypesRequest3 = new ListInfoTypesRequest();
54+
$infoTypes = $wrapper->dlp->listInfoTypes($listInfoTypesRequest3);
4955
$listSecretsRequest2 = (new ListSecretsRequest())
5056
->setParent('this/is/a/parent');
5157
$secrets = $wrapper->secretmanager->listSecrets($listSecretsRequest2);

src/Fixers/ClientUpgradeFixer/examples/legacy_inline_html.php renamed to examples/inline_html.legacy.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Google\Cloud\SecretManager\V1\SecretManagerServiceClient;
66
use Google\Cloud\Dlp\V2\DlpServiceClient;
7+
use Google\Protobuf\Internal\Message;
78

89
// Instantiate clients for calling the Google Cloud APIs.
910
$secretManagerClient = new SecretManagerServiceClient();

src/Fixers/ClientUpgradeFixer/examples/new_inline_html.php renamed to examples/inline_html.new.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Google\Cloud\Dlp\V2\ListDlpJobsRequest;
77
use Google\Cloud\SecretManager\V1\Client\SecretManagerServiceClient;
88
use Google\Cloud\SecretManager\V1\ListSecretsRequest;
9+
use Google\Protobuf\Internal\Message;
910

1011
// Instantiate clients for calling the Google Cloud APIs.
1112
$secretManagerClient = new SecretManagerServiceClient();

src/Fixers/ClientUpgradeFixer/examples/legacy_kitchen_sink.php renamed to examples/kitchen_sink.legacy.php

File renamed without changes.

src/Fixers/ClientUpgradeFixer/examples/new_kitchen_sink.php renamed to examples/kitchen_sink.new.php

File renamed without changes.

src/Fixers/ClientUpgradeFixer/examples/legacy_mixins.php renamed to examples/mixins.legacy.php

File renamed without changes.

src/Fixers/ClientUpgradeFixer/examples/new_mixins.php renamed to examples/mixins.new.php

File renamed without changes.

src/Fixers/ClientUpgradeFixer/examples/legacy_multiple_clients.php renamed to examples/multiple_clients.legacy.php

File renamed without changes.

src/Fixers/ClientUpgradeFixer/examples/new_multiple_clients.php renamed to examples/multiple_clients.new.php

File renamed without changes.

0 commit comments

Comments
 (0)