Skip to content

Commit 55a102f

Browse files
authored
chore: add typehints for storage samples (GoogleCloudPlatform#1703)
1 parent 55f6e2c commit 55a102f

File tree

97 files changed

+101
-101
lines changed

Some content is hidden

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

97 files changed

+101
-101
lines changed

storage/src/activate_hmac_key.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @param string $projectId The ID of your Google Cloud Platform project.
3333
* @param string $accessId Access ID for an inactive HMAC key.
3434
*/
35-
function activate_hmac_key($projectId, $accessId)
35+
function activate_hmac_key(string $projectId, string $accessId): void
3636
{
3737
// $projectId = 'my-project-id';
3838
// $accessId = 'GOOG0234230X00';

storage/src/add_bucket_acl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* @param string $entity The entity for which to update access controls.
3434
* @param string $role The permissions to add for the specified entity.
3535
*/
36-
function add_bucket_acl($bucketName, $entity, $role)
36+
function add_bucket_acl(string $bucketName, string $entity, string $role): void
3737
{
3838
// $bucketName = 'my-bucket';
3939
// $entity = '[email protected]';

storage/src/add_bucket_conditional_iam_binding.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* To see how to express a condition in CEL, visit:
4040
* @see https://cloud.google.com/storage/docs/access-control/iam#conditions.
4141
*/
42-
function add_bucket_conditional_iam_binding($bucketName, $role, array $members, $title, $description, $expression)
42+
function add_bucket_conditional_iam_binding(string $bucketName, string $role, array $members, string $title, string $description, string $expression): void
4343
{
4444
// $bucketName = 'my-bucket';
4545
// $role = 'roles/storage.objectViewer';

storage/src/add_bucket_default_acl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* @param string $entity The entity for which to update access controls.
3434
* @param string $role The permissions to add for the specified entity.
3535
*/
36-
function add_bucket_default_acl($bucketName, $entity, $role)
36+
function add_bucket_default_acl(string $bucketName, string $entity, string $role): void
3737
{
3838
// $bucketName = 'my-bucket';
3939
// $entity = '[email protected]';

storage/src/add_bucket_iam_member.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* @param string $role The role to which the given member should be added.
3434
* @param string[] $members The member(s) to be added to the role.
3535
*/
36-
function add_bucket_iam_member($bucketName, $role, array $members)
36+
function add_bucket_iam_member(string $bucketName, string $role, array $members): void
3737
{
3838
// $bucketName = 'my-bucket';
3939
// $role = 'roles/storage.objectViewer';

storage/src/add_bucket_label.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* @param string $labelName The name of the label to add.
3434
* @param string $labelValue The value of the label to add.
3535
*/
36-
function add_bucket_label($bucketName, $labelName, $labelValue)
36+
function add_bucket_label(string $bucketName, string $labelName, string $labelValue): void
3737
{
3838
// $bucketName = 'my-bucket';
3939
// $labelName = 'label-key-to-add';

storage/src/add_object_acl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @param string $entity The entity for which to update access controls.
3535
* @param string $role The permissions to add for the specified entity.
3636
*/
37-
function add_object_acl($bucketName, $objectName, $entity, $role)
37+
function add_object_acl(string $bucketName, string $objectName, string $entity, string $role): void
3838
{
3939
// $bucketName = 'my-bucket';
4040
// $objectName = 'my-object';

storage/src/bucket_delete_default_kms_key.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function bucket_delete_default_kms_key($bucketName)
34+
function bucket_delete_default_kms_key(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/change_default_storage_class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function change_default_storage_class($bucketName)
34+
function change_default_storage_class(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/change_file_storage_class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* @param string $objectName The name of your Cloud Storage object.
3434
* @param string $storageClass The storage class of the new object.
3535
*/
36-
function change_file_storage_class($bucketName, $objectName, $storageClass)
36+
function change_file_storage_class(string $bucketName, string $objectName, string $storageClass): void
3737
{
3838
// $bucketName = 'my-bucket';
3939
// $objectName = 'my-object';

storage/src/compose_file.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @param string $secondObjectName The name of the second GCS object to compose.
3535
* @param string $targetObjectName The name of the object to be created.
3636
*/
37-
function compose_file($bucketName, $firstObjectName, $secondObjectName, $targetObjectName)
37+
function compose_file(string $bucketName, string $firstObjectName, string $secondObjectName, string $targetObjectName): void
3838
{
3939
// $bucketName = 'my-bucket';
4040
// $firstObjectName = 'my-object-1';

storage/src/copy_file_archived_generation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @param string $generationToCopy The generation of the object to copy.
3535
* @param string $newObjectName The name of the target object.
3636
*/
37-
function copy_file_archived_generation($bucketName, $objectToCopy, $generationToCopy, $newObjectName)
37+
function copy_file_archived_generation(string $bucketName, string $objectToCopy, string $generationToCopy, string $newObjectName): void
3838
{
3939
// $bucketName = 'my-bucket';
4040
// $objectToCopy = 'my-object';

storage/src/copy_object.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @param string $newBucketName The destination bucket name.
3535
* @param string $newObjectName The destination object name.
3636
*/
37-
function copy_object($bucketName, $objectName, $newBucketName, $newObjectName)
37+
function copy_object(string $bucketName, string $objectName, string $newBucketName, string $newObjectName): void
3838
{
3939
// $bucketName = 'my-bucket';
4040
// $objectName = 'my-object';

storage/src/cors_configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* @param int $maxAgeSeconds The maximum amount of time the browser can make
3737
* requests before it must repeat preflighted requests.
3838
*/
39-
function cors_configuration($bucketName, $method, $origin, $responseHeader, $maxAgeSeconds)
39+
function cors_configuration(string $bucketName, string $method, string $origin, string $responseHeader, int $maxAgeSeconds): void
4040
{
4141
// $bucketName = 'my-bucket';
4242
// $method = 'GET';

storage/src/create_bucket.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function create_bucket($bucketName)
34+
function create_bucket(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/create_bucket_class_location.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function create_bucket_class_location($bucketName)
34+
function create_bucket_class_location(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/create_bucket_dual_region.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @param string $region1 First region for the bucket's regions. Case-insensitive.
3535
* @param string $region2 Second region for the bucket's regions. Case-insensitive.
3636
*/
37-
function create_bucket_dual_region($bucketName, $location, $region1, $region2)
37+
function create_bucket_dual_region(string $bucketName, string $location, string $region1, string $region2): void
3838
{
3939
// $bucketName = 'my-bucket';
4040
// $location = 'US';

storage/src/create_bucket_turbo_replication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @param string $location The Dual-Region location where you want your bucket to reside (e.g. "US-CENTRAL1+US-WEST1").
3535
Read more at https://cloud.google.com/storage/docs/locations#location-dr
3636
*/
37-
function create_bucket_turbo_replication($bucketName, $location = 'nam4')
37+
function create_bucket_turbo_replication(string $bucketName, string $location = 'nam4'): void
3838
{
3939
// $bucketName = 'my-bucket';
4040

storage/src/create_hmac_key.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @param string $projectId The ID of your Google Cloud Platform project.
3333
* @param string $serviceAccountEmail Service account email to associate with the new HMAC key.
3434
*/
35-
function create_hmac_key($projectId, $serviceAccountEmail)
35+
function create_hmac_key(string $projectId, string $serviceAccountEmail): void
3636
{
3737
// $projectId = 'my-project-id';
3838
// $serviceAccountEmail = '[email protected]';

storage/src/deactivate_hmac_key.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @param string $projectId The ID of your Google Cloud Platform project.
3333
* @param string $accessId Access ID for an inactive HMAC key.
3434
*/
35-
function deactivate_hmac_key($projectId, $accessId)
35+
function deactivate_hmac_key(string $projectId, string $accessId): void
3636
{
3737
// $projectId = 'my-project-id';
3838
// $accessId = 'GOOG0234230X00';

storage/src/define_bucket_website_configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* @param string $notFoundPageObject the name of an object in the bucket to use
3636
* as the 404 Not Found page.
3737
*/
38-
function define_bucket_website_configuration($bucketName, $indexPageObject, $notFoundPageObject)
38+
function define_bucket_website_configuration(string $bucketName, string $indexPageObject, string $notFoundPageObject): void
3939
{
4040
// $bucketName = 'my-bucket';
4141
// $indexPageObject = 'index.html';

storage/src/delete_bucket.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function delete_bucket($bucketName)
34+
function delete_bucket(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/delete_bucket_acl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
* @param string $entity The entity for which to update access controls.
3434
*/
35-
function delete_bucket_acl($bucketName, $entity)
35+
function delete_bucket_acl(string $bucketName, string $entity): void
3636
{
3737
// $bucketName = 'my-bucket';
3838
// $entity = '[email protected]';

storage/src/delete_bucket_default_acl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
* @param string $entity The entity for which to update access controls.
3434
*/
35-
function delete_bucket_default_acl($bucketName, $entity)
35+
function delete_bucket_default_acl(string $bucketName, string $entity): void
3636
{
3737
// $bucketName = 'my-bucket';
3838
// $entity = '[email protected]';

storage/src/delete_file_archived_generation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* @param string $objectName The name of your Cloud Storage object.
3434
* @param string $generationToDelete the generation of the object to delete.
3535
*/
36-
function delete_file_archived_generation($bucketName, $objectName, $generationToDelete)
36+
function delete_file_archived_generation(string $bucketName, string $objectName, string $generationToDelete): void
3737
{
3838
// $bucketName = 'my-bucket';
3939
// $objectName = 'my-object';

storage/src/delete_hmac_key.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @param string $projectId The ID of your Google Cloud Platform project.
3333
* @param string $accessId Access ID for an HMAC key.
3434
*/
35-
function delete_hmac_key($projectId, $accessId)
35+
function delete_hmac_key(string $projectId, string $accessId): void
3636
{
3737
// $projectId = 'my-project-id';
3838
// $accessId = 'GOOG0234230X00';

storage/src/delete_object.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
* @param string $objectName The name of your Cloud Storage object.
3434
*/
35-
function delete_object($bucketName, $objectName)
35+
function delete_object(string $bucketName, string $objectName): void
3636
{
3737
// $bucketName = 'my-bucket';
3838
// $objectName = 'my-object';

storage/src/delete_object_acl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* @param string $objectName The name of your Cloud Storage object.
3434
* @param string $entity The entity for which to update access controls.
3535
*/
36-
function delete_object_acl($bucketName, $objectName, $entity)
36+
function delete_object_acl(string $bucketName, string $objectName, string $entity): void
3737
{
3838
// $bucketName = 'my-bucket';
3939
// $objectName = 'my-object';

storage/src/disable_bucket_lifecycle_management.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function disable_bucket_lifecycle_management($bucketName)
34+
function disable_bucket_lifecycle_management(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/disable_default_event_based_hold.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function disable_default_event_based_hold($bucketName)
34+
function disable_default_event_based_hold(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/disable_requester_pays.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function disable_requester_pays($bucketName)
34+
function disable_requester_pays(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/disable_uniform_bucket_level_access.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function disable_uniform_bucket_level_access($bucketName)
34+
function disable_uniform_bucket_level_access(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/disable_versioning.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function disable_versioning($bucketName)
34+
function disable_versioning(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/download_encrypted_object.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* @param string $base64EncryptionKey The base64 encoded encryption key. Should
3636
* be the same key originally used to encrypt the object.
3737
*/
38-
function download_encrypted_object($bucketName, $objectName, $destination, $base64EncryptionKey)
38+
function download_encrypted_object(string $bucketName, string $objectName, string $destination, string $base64EncryptionKey): void
3939
{
4040
// $bucketName = 'my-bucket';
4141
// $objectName = 'my-object';

storage/src/download_file_requester_pays.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @param string $objectName The name of your Cloud Storage object.
3535
* @param string $destination The local destination to save the object.
3636
*/
37-
function download_file_requester_pays($projectId, $bucketName, $objectName, $destination)
37+
function download_file_requester_pays(string $projectId, string $bucketName, string $objectName, string $destination): void
3838
{
3939
// $projectId = 'my-project-id';
4040
// $bucketName = 'my-bucket';

storage/src/download_object.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @param string $objectName The name of your Cloud Storage object.
3535
* @param string $destination The local destination to save the object.
3636
*/
37-
function download_object($bucketName, $objectName, $destination)
37+
function download_object(string $bucketName, string $objectName, string $destination): void
3838
{
3939
// $bucketName = 'my-bucket';
4040
// $objectName = 'my-object';

storage/src/download_public_file.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* @param string $objectName The name of your Cloud Storage object.
3434
* @param string $destination The local destination to save the object.
3535
*/
36-
function download_public_file($bucketName, $objectName, $destination)
36+
function download_public_file(string $bucketName, string $objectName, string $destination): void
3737
{
3838
// $bucketName = 'my-bucket';
3939
// $objectName = 'my-object';

storage/src/enable_bucket_lifecycle_management.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*
3333
* @param string $bucketName The name of your Cloud Storage bucket.
3434
*/
35-
function enable_bucket_lifecycle_management($bucketName)
35+
function enable_bucket_lifecycle_management(string $bucketName): void
3636
{
3737
// $bucketName = 'my-bucket';
3838

storage/src/enable_default_event_based_hold.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function enable_default_event_based_hold($bucketName)
34+
function enable_default_event_based_hold(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/enable_default_kms_key.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* Key names are provided in the following format:
3535
* `projects//locations//keyRings//cryptoKeys/`.
3636
*/
37-
function enable_default_kms_key($bucketName, $kmsKeyName)
37+
function enable_default_kms_key(string $bucketName, string $kmsKeyName): void
3838
{
3939
// $bucketName = 'my-bucket';
4040
// $kmsKeyName = "";

storage/src/enable_requester_pays.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function enable_requester_pays($bucketName)
34+
function enable_requester_pays(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/enable_uniform_bucket_level_access.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function enable_uniform_bucket_level_access($bucketName)
34+
function enable_uniform_bucket_level_access(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/enable_versioning.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
*/
34-
function enable_versioning($bucketName)
34+
function enable_versioning(string $bucketName): void
3535
{
3636
// $bucketName = 'my-bucket';
3737

storage/src/generate_encryption_key.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
/**
2929
* Generate a base64 encoded encryption key for Google Cloud Storage.
3030
*/
31-
function generate_encryption_key()
31+
function generate_encryption_key(): void
3232
{
3333
$key = random_bytes(32);
3434
$encodedKey = base64_encode($key);

0 commit comments

Comments
 (0)