Skip to content

Commit

Permalink
Generate valid phpdoc param tags (#1457)
Browse files Browse the repository at this point in the history
* Fix the phpdoc of the RequestContext

* Generate valid phpdoc param tags

When an array shape key starts with a `@` like `@region`, it must be
quoted in the phpdoc as the unquoted one would be interpreted as the
next phpdoc tag.

* Use an unsealed shape for the type in Input

This avoids reports about passing extra keys from child classes in
Psalm.

* Allow passing null as the region in the input

The base input class already accept null values in addition to omitted
values for the region.

* Update the psalm baseline

* Disallow invalid docblocks in Psalm as well
  • Loading branch information
stof committed Jun 23, 2023
1 parent 3ea44a4 commit 7d1aab4
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 36 deletions.
27 changes: 9 additions & 18 deletions src/AppSyncClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ class AppSyncClient extends AbstractApi
* maxBatchSize?: int,
* runtime?: AppSyncRuntime|array,
* code?: string,
*
* @region?: string,
* '@region'?: string|null,
* }|CreateResolverRequest $input
*
* @throws ConcurrentModificationException
Expand Down Expand Up @@ -105,8 +104,7 @@ public function createResolver($input): CreateResolverResponse
* apiId: string,
* typeName: string,
* fieldName: string,
*
* @region?: string,
* '@region'?: string|null,
* }|DeleteResolverRequest $input
*
* @throws ConcurrentModificationException
Expand Down Expand Up @@ -137,8 +135,7 @@ public function deleteResolver($input): DeleteResolverResponse
*
* @param array{
* apiId: string,
*
* @region?: string,
* '@region'?: string|null,
* }|GetSchemaCreationStatusRequest $input
*
* @throws BadRequestException
Expand Down Expand Up @@ -173,8 +170,7 @@ public function getSchemaCreationStatus($input): GetSchemaCreationStatusResponse
* apiId: string,
* nextToken?: string,
* maxResults?: int,
*
* @region?: string,
* '@region'?: string|null,
* }|ListApiKeysRequest $input
*
* @throws BadRequestException
Expand Down Expand Up @@ -206,8 +202,7 @@ public function listApiKeys($input): ListApiKeysResponse
* typeName: string,
* nextToken?: string,
* maxResults?: int,
*
* @region?: string,
* '@region'?: string|null,
* }|ListResolversRequest $input
*
* @throws BadRequestException
Expand Down Expand Up @@ -239,8 +234,7 @@ public function listResolvers($input): ListResolversResponse
* @param array{
* apiId: string,
* definition: string,
*
* @region?: string,
* '@region'?: string|null,
* }|StartSchemaCreationRequest $input
*
* @throws BadRequestException
Expand Down Expand Up @@ -274,8 +268,7 @@ public function startSchemaCreation($input): StartSchemaCreationResponse
* id: string,
* description?: string,
* expires?: string,
*
* @region?: string,
* '@region'?: string|null,
* }|UpdateApiKeyRequest $input
*
* @throws BadRequestException
Expand Down Expand Up @@ -319,8 +312,7 @@ public function updateApiKey($input): UpdateApiKeyResponse
* httpConfig?: HttpDataSourceConfig|array,
* relationalDatabaseConfig?: RelationalDatabaseDataSourceConfig|array,
* eventBridgeConfig?: EventBridgeDataSourceConfig|array,
*
* @region?: string,
* '@region'?: string|null,
* }|UpdateDataSourceRequest $input
*
* @throws BadRequestException
Expand Down Expand Up @@ -363,8 +355,7 @@ public function updateDataSource($input): UpdateDataSourceResponse
* maxBatchSize?: int,
* runtime?: AppSyncRuntime|array,
* code?: string,
*
* @region?: string,
* '@region'?: string|null,
* }|UpdateResolverRequest $input
*
* @throws ConcurrentModificationException
Expand Down
3 changes: 1 addition & 2 deletions src/Input/CreateResolverRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ final class CreateResolverRequest extends Input
* maxBatchSize?: int,
* runtime?: AppSyncRuntime|array,
* code?: string,
*
* @region?: string,
* '@region'?: string|null,
* } $input
*/
public function __construct(array $input = [])
Expand Down
3 changes: 1 addition & 2 deletions src/Input/DeleteResolverRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ final class DeleteResolverRequest extends Input
* apiId?: string,
* typeName?: string,
* fieldName?: string,
*
* @region?: string,
* '@region'?: string|null,
* } $input
*/
public function __construct(array $input = [])
Expand Down
3 changes: 1 addition & 2 deletions src/Input/GetSchemaCreationStatusRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ final class GetSchemaCreationStatusRequest extends Input
/**
* @param array{
* apiId?: string,
*
* @region?: string,
* '@region'?: string|null,
* } $input
*/
public function __construct(array $input = [])
Expand Down
3 changes: 1 addition & 2 deletions src/Input/ListApiKeysRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ final class ListApiKeysRequest extends Input
* apiId?: string,
* nextToken?: string,
* maxResults?: int,
*
* @region?: string,
* '@region'?: string|null,
* } $input
*/
public function __construct(array $input = [])
Expand Down
3 changes: 1 addition & 2 deletions src/Input/ListResolversRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ final class ListResolversRequest extends Input
* typeName?: string,
* nextToken?: string,
* maxResults?: int,
*
* @region?: string,
* '@region'?: string|null,
* } $input
*/
public function __construct(array $input = [])
Expand Down
3 changes: 1 addition & 2 deletions src/Input/StartSchemaCreationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ final class StartSchemaCreationRequest extends Input
* @param array{
* apiId?: string,
* definition?: string,
*
* @region?: string,
* '@region'?: string|null,
* } $input
*/
public function __construct(array $input = [])
Expand Down
3 changes: 1 addition & 2 deletions src/Input/UpdateApiKeyRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ final class UpdateApiKeyRequest extends Input
* id?: string,
* description?: string,
* expires?: string,
*
* @region?: string,
* '@region'?: string|null,
* } $input
*/
public function __construct(array $input = [])
Expand Down
3 changes: 1 addition & 2 deletions src/Input/UpdateDataSourceRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ final class UpdateDataSourceRequest extends Input
* httpConfig?: HttpDataSourceConfig|array,
* relationalDatabaseConfig?: RelationalDatabaseDataSourceConfig|array,
* eventBridgeConfig?: EventBridgeDataSourceConfig|array,
*
* @region?: string,
* '@region'?: string|null,
* } $input
*/
public function __construct(array $input = [])
Expand Down
3 changes: 1 addition & 2 deletions src/Input/UpdateResolverRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ final class UpdateResolverRequest extends Input
* maxBatchSize?: int,
* runtime?: AppSyncRuntime|array,
* code?: string,
*
* @region?: string,
* '@region'?: string|null,
* } $input
*/
public function __construct(array $input = [])
Expand Down

0 comments on commit 7d1aab4

Please sign in to comment.