diff --git a/CHANGELOG.md b/CHANGELOG.md index eb7086f4..727050c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.17.0](https://github.com/googleapis/gapic-generator-php/compare/v1.16.1...v1.17.0) (2024-10-30) + + +### Features + +* Generic type for docs in async magic methods ([#732](https://github.com/googleapis/gapic-generator-php/issues/732)) ([68c88ed](https://github.com/googleapis/gapic-generator-php/commit/68c88eddcef45e100d357218e7f141d4f3b92a4d)) + ## [1.16.1](https://github.com/googleapis/gapic-generator-php/compare/v1.16.0...v1.16.1) (2024-08-08) diff --git a/src/Generation/GapicClientV2Generator.php b/src/Generation/GapicClientV2Generator.php index 1de81593..1ab92560 100644 --- a/src/Generation/GapicClientV2Generator.php +++ b/src/Generation/GapicClientV2Generator.php @@ -236,7 +236,7 @@ private function magicAsyncDocs(): PhpDoc ->filter(fn($m) => !$m->isStreaming()) ->map(fn($m) => PhpDoc::method( $m->methodName . "Async", - $this->ctx->type(Type::fromName(PromiseInterface::class))->type->name, + $this->asyncReturnType($m), $m->requestType->name, // the request type will already be imported for the sync variants )); return PhpDoc::block($methodDocs); @@ -415,7 +415,7 @@ private function resourceMethods(): Vector return Vector::new(); } $formattedName = AST::param(ResolvedType::string(), AST::var('formattedName')); - $template = AST::param(ResolvedType::string(), AST::var('template'), AST::NULL); + $template = AST::param(ResolvedType::string(true), AST::var('template'), AST::NULL); return $this->serviceDetails->resourceParts ->map(fn ($x) => $x->getFormatMethod() @@ -887,4 +887,14 @@ private function snippetPathForMethod(MethodDetails $method): string return "samples/{$version}{$emptyClientName}/{$methodName}.php"; } + + private function asyncReturnType(MethodDetails $method): string + { + $returnType = $this->ctx->type(Type::fromName(PromiseInterface::class))->type->name; + $nestedType = ($method->hasEmptyResponse) + ? 'void' + : $this->ctx->type($method->methodReturnType)->type->name; + + return sprintf('%s<%s>', $returnType, $nestedType); + } } diff --git a/src/Utils/ResolvedType.php b/src/Utils/ResolvedType.php index 983a1d3e..fc0ecf91 100644 --- a/src/Utils/ResolvedType.php +++ b/src/Utils/ResolvedType.php @@ -18,6 +18,8 @@ namespace Google\Generator\Utils; +use Closure; + /** * Represent a resolved type, ready to use in code output. * This class is required to allow a resolved type to be differentiated from other plain strings. @@ -29,9 +31,9 @@ class ResolvedType * * @return ResolvedType */ - public static function array(): ResolvedType + public static function array(bool $optional = false): ResolvedType { - return new ResolvedType(Type::array(), fn () => 'array'); + return new ResolvedType(Type::array(), fn () => 'array', $optional); } /** @@ -39,9 +41,9 @@ public static function array(): ResolvedType * * @return ResolvedType */ - public static function string(): ResolvedType + public static function string(bool $optional = false): ResolvedType { - return new ResolvedType(Type::string(), fn () => 'string'); + return new ResolvedType(Type::string(), fn () => 'string', $optional); } /** @@ -69,19 +71,16 @@ public static function self(): ResolvedType * * @param string $typeName The resolved name of the type. */ - public function __construct(Type $type, \Closure $fnToCode) - { - $this->type = $type; - $this->fnToCode = $fnToCode; + public function __construct( + /** @var Type *Readonly* The type of this resolved-type. */ + public ReadOnly Type $type, + private Closure $fnToCode, + private bool $optional = false + ) { } - /** @var Type *Readonly* The type of this resolved-type. */ - public Type $type; - - private \Closure $fnToCode; - public function toCode(): string { - return ($this->fnToCode)(); + return ($this->optional ? '?' : '') . ($this->fnToCode)(); } } diff --git a/tests/Integration/goldens/functions/src/V1/Client/CloudFunctionsServiceClient.php b/tests/Integration/goldens/functions/src/V1/Client/CloudFunctionsServiceClient.php index ef177931..a1145977 100644 --- a/tests/Integration/goldens/functions/src/V1/Client/CloudFunctionsServiceClient.php +++ b/tests/Integration/goldens/functions/src/V1/Client/CloudFunctionsServiceClient.php @@ -67,17 +67,17 @@ * name, and additionally a parseName method to extract the individual identifiers * contained within formatted names that are returned by the API. * - * @method PromiseInterface callFunctionAsync(CallFunctionRequest $request, array $optionalArgs = []) - * @method PromiseInterface createFunctionAsync(CreateFunctionRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteFunctionAsync(DeleteFunctionRequest $request, array $optionalArgs = []) - * @method PromiseInterface generateDownloadUrlAsync(GenerateDownloadUrlRequest $request, array $optionalArgs = []) - * @method PromiseInterface generateUploadUrlAsync(GenerateUploadUrlRequest $request, array $optionalArgs = []) - * @method PromiseInterface getFunctionAsync(GetFunctionRequest $request, array $optionalArgs = []) - * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) - * @method PromiseInterface listFunctionsAsync(ListFunctionsRequest $request, array $optionalArgs = []) - * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) - * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateFunctionAsync(UpdateFunctionRequest $request, array $optionalArgs = []) + * @method PromiseInterface callFunctionAsync(CallFunctionRequest $request, array $optionalArgs = []) + * @method PromiseInterface createFunctionAsync(CreateFunctionRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteFunctionAsync(DeleteFunctionRequest $request, array $optionalArgs = []) + * @method PromiseInterface generateDownloadUrlAsync(GenerateDownloadUrlRequest $request, array $optionalArgs = []) + * @method PromiseInterface generateUploadUrlAsync(GenerateUploadUrlRequest $request, array $optionalArgs = []) + * @method PromiseInterface getFunctionAsync(GetFunctionRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface listFunctionsAsync(ListFunctionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateFunctionAsync(UpdateFunctionRequest $request, array $optionalArgs = []) */ final class CloudFunctionsServiceClient { @@ -268,14 +268,14 @@ public static function repositoryName(string $project, string $location, string * listed, then parseName will check each of the supported templates, and return * the first match. * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match * * @return array An associative array from name component IDs to component values. * * @throws ValidationException If $formattedName could not be matched. */ - public static function parseName(string $formattedName, string $template = null): array + public static function parseName(string $formattedName, ?string $template = null): array { return self::parseFormattedName($formattedName, $template); } diff --git a/tests/Integration/goldens/redis/src/V1/Client/CloudRedisClient.php b/tests/Integration/goldens/redis/src/V1/Client/CloudRedisClient.php index 5e8b8313..b4bf8dcc 100644 --- a/tests/Integration/goldens/redis/src/V1/Client/CloudRedisClient.php +++ b/tests/Integration/goldens/redis/src/V1/Client/CloudRedisClient.php @@ -80,19 +80,19 @@ * name, and additionally a parseName method to extract the individual identifiers * contained within formatted names that are returned by the API. * - * @method PromiseInterface createInstanceAsync(CreateInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteInstanceAsync(DeleteInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface exportInstanceAsync(ExportInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface failoverInstanceAsync(FailoverInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface getInstanceAsync(GetInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface getInstanceAuthStringAsync(GetInstanceAuthStringRequest $request, array $optionalArgs = []) - * @method PromiseInterface importInstanceAsync(ImportInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface listInstancesAsync(ListInstancesRequest $request, array $optionalArgs = []) - * @method PromiseInterface rescheduleMaintenanceAsync(RescheduleMaintenanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateInstanceAsync(UpdateInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface upgradeInstanceAsync(UpgradeInstanceRequest $request, array $optionalArgs = []) - * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) - * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) + * @method PromiseInterface createInstanceAsync(CreateInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteInstanceAsync(DeleteInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface exportInstanceAsync(ExportInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface failoverInstanceAsync(FailoverInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface getInstanceAsync(GetInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface getInstanceAuthStringAsync(GetInstanceAuthStringRequest $request, array $optionalArgs = []) + * @method PromiseInterface importInstanceAsync(ImportInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface listInstancesAsync(ListInstancesRequest $request, array $optionalArgs = []) + * @method PromiseInterface rescheduleMaintenanceAsync(RescheduleMaintenanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateInstanceAsync(UpdateInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface upgradeInstanceAsync(UpgradeInstanceRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) */ final class CloudRedisClient { @@ -245,14 +245,14 @@ public static function locationName(string $project, string $location): string * listed, then parseName will check each of the supported templates, and return * the first match. * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match * * @return array An associative array from name component IDs to component values. * * @throws ValidationException If $formattedName could not be matched. */ - public static function parseName(string $formattedName, string $template = null): array + public static function parseName(string $formattedName, ?string $template = null): array { return self::parseFormattedName($formattedName, $template); } diff --git a/tests/Integration/goldens/securitycenter/src/V1/Client/SecurityCenterClient.php b/tests/Integration/goldens/securitycenter/src/V1/Client/SecurityCenterClient.php index a45008a9..12d0251b 100644 --- a/tests/Integration/goldens/securitycenter/src/V1/Client/SecurityCenterClient.php +++ b/tests/Integration/goldens/securitycenter/src/V1/Client/SecurityCenterClient.php @@ -108,51 +108,51 @@ * name, and additionally a parseName method to extract the individual identifiers * contained within formatted names that are returned by the API. * - * @method PromiseInterface bulkMuteFindingsAsync(BulkMuteFindingsRequest $request, array $optionalArgs = []) - * @method PromiseInterface createBigQueryExportAsync(CreateBigQueryExportRequest $request, array $optionalArgs = []) - * @method PromiseInterface createFindingAsync(CreateFindingRequest $request, array $optionalArgs = []) - * @method PromiseInterface createMuteConfigAsync(CreateMuteConfigRequest $request, array $optionalArgs = []) - * @method PromiseInterface createNotificationConfigAsync(CreateNotificationConfigRequest $request, array $optionalArgs = []) - * @method PromiseInterface createSecurityHealthAnalyticsCustomModuleAsync(CreateSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) - * @method PromiseInterface createSourceAsync(CreateSourceRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteBigQueryExportAsync(DeleteBigQueryExportRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteMuteConfigAsync(DeleteMuteConfigRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteNotificationConfigAsync(DeleteNotificationConfigRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteSecurityHealthAnalyticsCustomModuleAsync(DeleteSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) - * @method PromiseInterface getBigQueryExportAsync(GetBigQueryExportRequest $request, array $optionalArgs = []) - * @method PromiseInterface getEffectiveSecurityHealthAnalyticsCustomModuleAsync(GetEffectiveSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) - * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) - * @method PromiseInterface getMuteConfigAsync(GetMuteConfigRequest $request, array $optionalArgs = []) - * @method PromiseInterface getNotificationConfigAsync(GetNotificationConfigRequest $request, array $optionalArgs = []) - * @method PromiseInterface getOrganizationSettingsAsync(GetOrganizationSettingsRequest $request, array $optionalArgs = []) - * @method PromiseInterface getSecurityHealthAnalyticsCustomModuleAsync(GetSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) - * @method PromiseInterface getSourceAsync(GetSourceRequest $request, array $optionalArgs = []) - * @method PromiseInterface groupAssetsAsync(GroupAssetsRequest $request, array $optionalArgs = []) - * @method PromiseInterface groupFindingsAsync(GroupFindingsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listAssetsAsync(ListAssetsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listBigQueryExportsAsync(ListBigQueryExportsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listDescendantSecurityHealthAnalyticsCustomModulesAsync(ListDescendantSecurityHealthAnalyticsCustomModulesRequest $request, array $optionalArgs = []) - * @method PromiseInterface listEffectiveSecurityHealthAnalyticsCustomModulesAsync(ListEffectiveSecurityHealthAnalyticsCustomModulesRequest $request, array $optionalArgs = []) - * @method PromiseInterface listFindingsAsync(ListFindingsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listMuteConfigsAsync(ListMuteConfigsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listNotificationConfigsAsync(ListNotificationConfigsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listSecurityHealthAnalyticsCustomModulesAsync(ListSecurityHealthAnalyticsCustomModulesRequest $request, array $optionalArgs = []) - * @method PromiseInterface listSourcesAsync(ListSourcesRequest $request, array $optionalArgs = []) - * @method PromiseInterface runAssetDiscoveryAsync(RunAssetDiscoveryRequest $request, array $optionalArgs = []) - * @method PromiseInterface setFindingStateAsync(SetFindingStateRequest $request, array $optionalArgs = []) - * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) - * @method PromiseInterface setMuteAsync(SetMuteRequest $request, array $optionalArgs = []) - * @method PromiseInterface simulateSecurityHealthAnalyticsCustomModuleAsync(SimulateSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) - * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateBigQueryExportAsync(UpdateBigQueryExportRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateExternalSystemAsync(UpdateExternalSystemRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateFindingAsync(UpdateFindingRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateMuteConfigAsync(UpdateMuteConfigRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateNotificationConfigAsync(UpdateNotificationConfigRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateOrganizationSettingsAsync(UpdateOrganizationSettingsRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateSecurityHealthAnalyticsCustomModuleAsync(UpdateSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateSecurityMarksAsync(UpdateSecurityMarksRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateSourceAsync(UpdateSourceRequest $request, array $optionalArgs = []) + * @method PromiseInterface bulkMuteFindingsAsync(BulkMuteFindingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface createBigQueryExportAsync(CreateBigQueryExportRequest $request, array $optionalArgs = []) + * @method PromiseInterface createFindingAsync(CreateFindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface createMuteConfigAsync(CreateMuteConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface createNotificationConfigAsync(CreateNotificationConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface createSecurityHealthAnalyticsCustomModuleAsync(CreateSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface createSourceAsync(CreateSourceRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteBigQueryExportAsync(DeleteBigQueryExportRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteMuteConfigAsync(DeleteMuteConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteNotificationConfigAsync(DeleteNotificationConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteSecurityHealthAnalyticsCustomModuleAsync(DeleteSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getBigQueryExportAsync(GetBigQueryExportRequest $request, array $optionalArgs = []) + * @method PromiseInterface getEffectiveSecurityHealthAnalyticsCustomModuleAsync(GetEffectiveSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface getMuteConfigAsync(GetMuteConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface getNotificationConfigAsync(GetNotificationConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface getOrganizationSettingsAsync(GetOrganizationSettingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface getSecurityHealthAnalyticsCustomModuleAsync(GetSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getSourceAsync(GetSourceRequest $request, array $optionalArgs = []) + * @method PromiseInterface groupAssetsAsync(GroupAssetsRequest $request, array $optionalArgs = []) + * @method PromiseInterface groupFindingsAsync(GroupFindingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listAssetsAsync(ListAssetsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listBigQueryExportsAsync(ListBigQueryExportsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDescendantSecurityHealthAnalyticsCustomModulesAsync(ListDescendantSecurityHealthAnalyticsCustomModulesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listEffectiveSecurityHealthAnalyticsCustomModulesAsync(ListEffectiveSecurityHealthAnalyticsCustomModulesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listFindingsAsync(ListFindingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listMuteConfigsAsync(ListMuteConfigsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listNotificationConfigsAsync(ListNotificationConfigsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listSecurityHealthAnalyticsCustomModulesAsync(ListSecurityHealthAnalyticsCustomModulesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listSourcesAsync(ListSourcesRequest $request, array $optionalArgs = []) + * @method PromiseInterface runAssetDiscoveryAsync(RunAssetDiscoveryRequest $request, array $optionalArgs = []) + * @method PromiseInterface setFindingStateAsync(SetFindingStateRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface setMuteAsync(SetMuteRequest $request, array $optionalArgs = []) + * @method PromiseInterface simulateSecurityHealthAnalyticsCustomModuleAsync(SimulateSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateBigQueryExportAsync(UpdateBigQueryExportRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateExternalSystemAsync(UpdateExternalSystemRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateFindingAsync(UpdateFindingRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateMuteConfigAsync(UpdateMuteConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateNotificationConfigAsync(UpdateNotificationConfigRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateOrganizationSettingsAsync(UpdateOrganizationSettingsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateSecurityHealthAnalyticsCustomModuleAsync(UpdateSecurityHealthAnalyticsCustomModuleRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateSecurityMarksAsync(UpdateSecurityMarksRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateSourceAsync(UpdateSourceRequest $request, array $optionalArgs = []) */ final class SecurityCenterClient { @@ -1234,14 +1234,14 @@ public static function topicName(string $project, string $topic): string * listed, then parseName will check each of the supported templates, and return * the first match. * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match * * @return array An associative array from name component IDs to component values. * * @throws ValidationException If $formattedName could not be matched. */ - public static function parseName(string $formattedName, string $template = null): array + public static function parseName(string $formattedName, ?string $template = null): array { return self::parseFormattedName($formattedName, $template); } diff --git a/tests/Integration/goldens/spanner/src/V1/Client/DatabaseAdminClient.php b/tests/Integration/goldens/spanner/src/V1/Client/DatabaseAdminClient.php index e7d583b1..e1b0007a 100644 --- a/tests/Integration/goldens/spanner/src/V1/Client/DatabaseAdminClient.php +++ b/tests/Integration/goldens/spanner/src/V1/Client/DatabaseAdminClient.php @@ -89,26 +89,26 @@ * name, and additionally a parseName method to extract the individual identifiers * contained within formatted names that are returned by the API. * - * @method PromiseInterface copyBackupAsync(CopyBackupRequest $request, array $optionalArgs = []) - * @method PromiseInterface createBackupAsync(CreateBackupRequest $request, array $optionalArgs = []) - * @method PromiseInterface createDatabaseAsync(CreateDatabaseRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteBackupAsync(DeleteBackupRequest $request, array $optionalArgs = []) - * @method PromiseInterface dropDatabaseAsync(DropDatabaseRequest $request, array $optionalArgs = []) - * @method PromiseInterface getBackupAsync(GetBackupRequest $request, array $optionalArgs = []) - * @method PromiseInterface getDatabaseAsync(GetDatabaseRequest $request, array $optionalArgs = []) - * @method PromiseInterface getDatabaseDdlAsync(GetDatabaseDdlRequest $request, array $optionalArgs = []) - * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) - * @method PromiseInterface listBackupOperationsAsync(ListBackupOperationsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listBackupsAsync(ListBackupsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listDatabaseOperationsAsync(ListDatabaseOperationsRequest $request, array $optionalArgs = []) - * @method PromiseInterface listDatabaseRolesAsync(ListDatabaseRolesRequest $request, array $optionalArgs = []) - * @method PromiseInterface listDatabasesAsync(ListDatabasesRequest $request, array $optionalArgs = []) - * @method PromiseInterface restoreDatabaseAsync(RestoreDatabaseRequest $request, array $optionalArgs = []) - * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) - * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateBackupAsync(UpdateBackupRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateDatabaseAsync(UpdateDatabaseRequest $request, array $optionalArgs = []) - * @method PromiseInterface updateDatabaseDdlAsync(UpdateDatabaseDdlRequest $request, array $optionalArgs = []) + * @method PromiseInterface copyBackupAsync(CopyBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface createBackupAsync(CreateBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface createDatabaseAsync(CreateDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteBackupAsync(DeleteBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface dropDatabaseAsync(DropDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface getBackupAsync(GetBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDatabaseAsync(GetDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface getDatabaseDdlAsync(GetDatabaseDdlRequest $request, array $optionalArgs = []) + * @method PromiseInterface getIamPolicyAsync(GetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface listBackupOperationsAsync(ListBackupOperationsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listBackupsAsync(ListBackupsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDatabaseOperationsAsync(ListDatabaseOperationsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDatabaseRolesAsync(ListDatabaseRolesRequest $request, array $optionalArgs = []) + * @method PromiseInterface listDatabasesAsync(ListDatabasesRequest $request, array $optionalArgs = []) + * @method PromiseInterface restoreDatabaseAsync(RestoreDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface setIamPolicyAsync(SetIamPolicyRequest $request, array $optionalArgs = []) + * @method PromiseInterface testIamPermissionsAsync(TestIamPermissionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateBackupAsync(UpdateBackupRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateDatabaseAsync(UpdateDatabaseRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateDatabaseDdlAsync(UpdateDatabaseDdlRequest $request, array $optionalArgs = []) */ final class DatabaseAdminClient { @@ -305,14 +305,14 @@ public static function instanceName(string $project, string $instance): string * listed, then parseName will check each of the supported templates, and return * the first match. * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match * * @return array An associative array from name component IDs to component values. * * @throws ValidationException If $formattedName could not be matched. */ - public static function parseName(string $formattedName, string $template = null): array + public static function parseName(string $formattedName, ?string $template = null): array { return self::parseFormattedName($formattedName, $template); } diff --git a/tests/Unit/ProtoTests/Basic/out/src/Client/BasicClient.php b/tests/Unit/ProtoTests/Basic/out/src/Client/BasicClient.php index 0173d742..dc38f7f8 100644 --- a/tests/Unit/ProtoTests/Basic/out/src/Client/BasicClient.php +++ b/tests/Unit/ProtoTests/Basic/out/src/Client/BasicClient.php @@ -45,8 +45,8 @@ * This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. * - * @method PromiseInterface aMethodAsync(Request $request, array $optionalArgs = []) - * @method PromiseInterface methodWithArgsAsync(RequestWithArgs $request, array $optionalArgs = []) + * @method PromiseInterface aMethodAsync(Request $request, array $optionalArgs = []) + * @method PromiseInterface methodWithArgsAsync(RequestWithArgs $request, array $optionalArgs = []) */ final class BasicClient { diff --git a/tests/Unit/ProtoTests/BasicOneofNew/out/src/Client/BasicOneofNewClient.php b/tests/Unit/ProtoTests/BasicOneofNew/out/src/Client/BasicOneofNewClient.php index aa7e8c0a..2ff68cf6 100644 --- a/tests/Unit/ProtoTests/BasicOneofNew/out/src/Client/BasicOneofNewClient.php +++ b/tests/Unit/ProtoTests/BasicOneofNew/out/src/Client/BasicOneofNewClient.php @@ -42,7 +42,7 @@ * This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. * - * @method PromiseInterface aMethodAsync(Request $request, array $optionalArgs = []) + * @method PromiseInterface aMethodAsync(Request $request, array $optionalArgs = []) */ final class BasicOneofNewClient { diff --git a/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroClient.php b/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroClient.php index e483fc37..756a0b93 100644 --- a/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroClient.php +++ b/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroClient.php @@ -42,7 +42,7 @@ * This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. * - * @method PromiseInterface createFooAsync(CreateFooRequest $request, array $optionalArgs = []) + * @method PromiseInterface createFooAsync(CreateFooRequest $request, array $optionalArgs = []) */ final class CustomLroClient { diff --git a/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroOperationsClient.php b/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroOperationsClient.php index 2571c469..d3e4f4be 100644 --- a/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroOperationsClient.php +++ b/tests/Unit/ProtoTests/CustomLroNew/out/src/Client/CustomLroOperationsClient.php @@ -44,9 +44,9 @@ * This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. * - * @method PromiseInterface cancelAsync(CancelOperationRequest $request, array $optionalArgs = []) - * @method PromiseInterface deleteAsync(DeleteOperationRequest $request, array $optionalArgs = []) - * @method PromiseInterface getAsync(GetOperationRequest $request, array $optionalArgs = []) + * @method PromiseInterface cancelAsync(CancelOperationRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteAsync(DeleteOperationRequest $request, array $optionalArgs = []) + * @method PromiseInterface getAsync(GetOperationRequest $request, array $optionalArgs = []) */ final class CustomLroOperationsClient { diff --git a/tests/Unit/ProtoTests/ResourceNames/out/src/Client/ResourceNamesClient.php b/tests/Unit/ProtoTests/ResourceNames/out/src/Client/ResourceNamesClient.php index 3da9cdc6..174f0a5b 100644 --- a/tests/Unit/ProtoTests/ResourceNames/out/src/Client/ResourceNamesClient.php +++ b/tests/Unit/ProtoTests/ResourceNames/out/src/Client/ResourceNamesClient.php @@ -56,15 +56,15 @@ * name, and additionally a parseName method to extract the individual identifiers * contained within formatted names that are returned by the API. * - * @method PromiseInterface fileLevelChildTypeRefMethodAsync(FileLevelChildTypeRefRequest $request, array $optionalArgs = []) - * @method PromiseInterface fileLevelTypeRefMethodAsync(FileLevelTypeRefRequest $request, array $optionalArgs = []) - * @method PromiseInterface multiPatternMethodAsync(MultiPatternRequest $request, array $optionalArgs = []) - * @method PromiseInterface nestedReferenceMethodAsync(NestedReferenceRequest $request, array $optionalArgs = []) - * @method PromiseInterface singlePatternMethodAsync(SinglePatternRequest $request, array $optionalArgs = []) - * @method PromiseInterface wildcardChildReferenceMethodAsync(WildcardChildReferenceRequest $request, array $optionalArgs = []) - * @method PromiseInterface wildcardMethodAsync(WildcardPatternRequest $request, array $optionalArgs = []) - * @method PromiseInterface wildcardMultiMethodAsync(WildcardMultiPatternRequest $request, array $optionalArgs = []) - * @method PromiseInterface wildcardReferenceMethodAsync(WildcardReferenceRequest $request, array $optionalArgs = []) + * @method PromiseInterface fileLevelChildTypeRefMethodAsync(FileLevelChildTypeRefRequest $request, array $optionalArgs = []) + * @method PromiseInterface fileLevelTypeRefMethodAsync(FileLevelTypeRefRequest $request, array $optionalArgs = []) + * @method PromiseInterface multiPatternMethodAsync(MultiPatternRequest $request, array $optionalArgs = []) + * @method PromiseInterface nestedReferenceMethodAsync(NestedReferenceRequest $request, array $optionalArgs = []) + * @method PromiseInterface singlePatternMethodAsync(SinglePatternRequest $request, array $optionalArgs = []) + * @method PromiseInterface wildcardChildReferenceMethodAsync(WildcardChildReferenceRequest $request, array $optionalArgs = []) + * @method PromiseInterface wildcardMethodAsync(WildcardPatternRequest $request, array $optionalArgs = []) + * @method PromiseInterface wildcardMultiMethodAsync(WildcardMultiPatternRequest $request, array $optionalArgs = []) + * @method PromiseInterface wildcardReferenceMethodAsync(WildcardReferenceRequest $request, array $optionalArgs = []) */ final class ResourceNamesClient { @@ -422,14 +422,14 @@ public static function wildcardMultiPatternName(string $item1Id): string * listed, then parseName will check each of the supported templates, and return * the first match. * - * @param string $formattedName The formatted name string - * @param string $template Optional name of template to match + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match * * @return array An associative array from name component IDs to component values. * * @throws ValidationException If $formattedName could not be matched. */ - public static function parseName(string $formattedName, string $template = null): array + public static function parseName(string $formattedName, ?string $template = null): array { return self::parseFormattedName($formattedName, $template); } diff --git a/tests/Unit/ProtoTests/RoutingHeaders/out/src/Client/RoutingHeadersClient.php b/tests/Unit/ProtoTests/RoutingHeaders/out/src/Client/RoutingHeadersClient.php index dd5935f5..a8e7e587 100644 --- a/tests/Unit/ProtoTests/RoutingHeaders/out/src/Client/RoutingHeadersClient.php +++ b/tests/Unit/ProtoTests/RoutingHeaders/out/src/Client/RoutingHeadersClient.php @@ -44,18 +44,18 @@ * This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. * - * @method PromiseInterface deleteMethodAsync(SimpleRequest $request, array $optionalArgs = []) - * @method PromiseInterface getMethodAsync(SimpleRequest $request, array $optionalArgs = []) - * @method PromiseInterface getNoPlaceholdersMethodAsync(SimpleRequest $request, array $optionalArgs = []) - * @method PromiseInterface getNoTemplateMethodAsync(SimpleRequest $request, array $optionalArgs = []) - * @method PromiseInterface nestedMethodAsync(NestedRequest $request, array $optionalArgs = []) - * @method PromiseInterface nestedMultiMethodAsync(NestedRequest $request, array $optionalArgs = []) - * @method PromiseInterface orderingMethodAsync(OrderRequest $request, array $optionalArgs = []) - * @method PromiseInterface patchMethodAsync(SimpleRequest $request, array $optionalArgs = []) - * @method PromiseInterface postMethodAsync(SimpleRequest $request, array $optionalArgs = []) - * @method PromiseInterface putMethodAsync(SimpleRequest $request, array $optionalArgs = []) - * @method PromiseInterface routingRuleWithOutParametersAsync(NestedRequest $request, array $optionalArgs = []) - * @method PromiseInterface routingRuleWithParametersAsync(NestedRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getNoPlaceholdersMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getNoTemplateMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface nestedMethodAsync(NestedRequest $request, array $optionalArgs = []) + * @method PromiseInterface nestedMultiMethodAsync(NestedRequest $request, array $optionalArgs = []) + * @method PromiseInterface orderingMethodAsync(OrderRequest $request, array $optionalArgs = []) + * @method PromiseInterface patchMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface postMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface putMethodAsync(SimpleRequest $request, array $optionalArgs = []) + * @method PromiseInterface routingRuleWithOutParametersAsync(NestedRequest $request, array $optionalArgs = []) + * @method PromiseInterface routingRuleWithParametersAsync(NestedRequest $request, array $optionalArgs = []) */ final class RoutingHeadersClient { diff --git a/version.txt b/version.txt index 41c11ffb..092afa15 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.16.1 +1.17.0