Skip to content

Commit 2b12db5

Browse files
authored
Generate valid phpdoc param tags (#1457)
* 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
1 parent 2ce454a commit 2b12db5

18 files changed

+36
-72
lines changed

src/DynamoDbClient.php

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ class DynamoDbClient extends AbstractApi
135135
* @param array{
136136
* RequestItems: array<string, KeysAndAttributes>,
137137
* ReturnConsumedCapacity?: ReturnConsumedCapacity::*,
138-
*
139-
* @region?: string,
138+
* '@region'?: string|null,
140139
* }|BatchGetItemInput $input
141140
*
142141
* @throws ProvisionedThroughputExceededException
@@ -224,8 +223,7 @@ public function batchGetItem($input): BatchGetItemOutput
224223
* RequestItems: array<string, array>,
225224
* ReturnConsumedCapacity?: ReturnConsumedCapacity::*,
226225
* ReturnItemCollectionMetrics?: ReturnItemCollectionMetrics::*,
227-
*
228-
* @region?: string,
226+
* '@region'?: string|null,
229227
* }|BatchWriteItemInput $input
230228
*
231229
* @throws ProvisionedThroughputExceededException
@@ -279,8 +277,7 @@ public function batchWriteItem($input): BatchWriteItemOutput
279277
* Tags?: Tag[],
280278
* TableClass?: TableClass::*,
281279
* DeletionProtectionEnabled?: bool,
282-
*
283-
* @region?: string,
280+
* '@region'?: string|null,
284281
* }|CreateTableInput $input
285282
*
286283
* @throws ResourceInUseException
@@ -326,8 +323,7 @@ public function createTable($input): CreateTableOutput
326323
* ConditionExpression?: string,
327324
* ExpressionAttributeNames?: array<string, string>,
328325
* ExpressionAttributeValues?: array<string, AttributeValue>,
329-
*
330-
* @region?: string,
326+
* '@region'?: string|null,
331327
* }|DeleteItemInput $input
332328
*
333329
* @throws ConditionalCheckFailedException
@@ -380,8 +376,7 @@ public function deleteItem($input): DeleteItemOutput
380376
*
381377
* @param array{
382378
* TableName: string,
383-
*
384-
* @region?: string,
379+
* '@region'?: string|null,
385380
* }|DeleteTableInput $input
386381
*
387382
* @throws ResourceInUseException
@@ -412,8 +407,7 @@ public function deleteTable($input): DeleteTableOutput
412407
* @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-dynamodb-2012-08-10.html#describeendpoints
413408
*
414409
* @param array{
415-
*
416-
* @region?: string,
410+
* '@region'?: string|null,
417411
* }|DescribeEndpointsRequest $input
418412
*/
419413
public function describeEndpoints($input = []): DescribeEndpointsResponse
@@ -442,8 +436,7 @@ public function describeEndpoints($input = []): DescribeEndpointsResponse
442436
*
443437
* @param array{
444438
* TableName: string,
445-
*
446-
* @region?: string,
439+
* '@region'?: string|null,
447440
* }|DescribeTableInput $input
448441
*
449442
* @throws ResourceNotFoundException
@@ -483,8 +476,7 @@ public function describeTable($input): DescribeTableOutput
483476
* NextToken?: string,
484477
* ReturnConsumedCapacity?: ReturnConsumedCapacity::*,
485478
* Limit?: int,
486-
*
487-
* @region?: string,
479+
* '@region'?: string|null,
488480
* }|ExecuteStatementInput $input
489481
*
490482
* @throws ConditionalCheckFailedException
@@ -532,8 +524,7 @@ public function executeStatement($input): ExecuteStatementOutput
532524
* ReturnConsumedCapacity?: ReturnConsumedCapacity::*,
533525
* ProjectionExpression?: string,
534526
* ExpressionAttributeNames?: array<string, string>,
535-
*
536-
* @region?: string,
527+
* '@region'?: string|null,
537528
* }|GetItemInput $input
538529
*
539530
* @throws ProvisionedThroughputExceededException
@@ -564,8 +555,7 @@ public function getItem($input): GetItemOutput
564555
* @param array{
565556
* ExclusiveStartTableName?: string,
566557
* Limit?: int,
567-
*
568-
* @region?: string,
558+
* '@region'?: string|null,
569559
* }|ListTablesInput $input
570560
*
571561
* @throws InternalServerErrorException
@@ -618,8 +608,7 @@ public function listTables($input = []): ListTablesOutput
618608
* ConditionExpression?: string,
619609
* ExpressionAttributeNames?: array<string, string>,
620610
* ExpressionAttributeValues?: array<string, AttributeValue>,
621-
*
622-
* @region?: string,
611+
* '@region'?: string|null,
623612
* }|PutItemInput $input
624613
*
625614
* @throws ConditionalCheckFailedException
@@ -709,8 +698,7 @@ public function putItem($input): PutItemOutput
709698
* KeyConditionExpression?: string,
710699
* ExpressionAttributeNames?: array<string, string>,
711700
* ExpressionAttributeValues?: array<string, AttributeValue>,
712-
*
713-
* @region?: string,
701+
* '@region'?: string|null,
714702
* }|QueryInput $input
715703
*
716704
* @throws ProvisionedThroughputExceededException
@@ -775,8 +763,7 @@ public function query($input): QueryOutput
775763
* ExpressionAttributeNames?: array<string, string>,
776764
* ExpressionAttributeValues?: array<string, AttributeValue>,
777765
* ConsistentRead?: bool,
778-
*
779-
* @region?: string,
766+
* '@region'?: string|null,
780767
* }|ScanInput $input
781768
*
782769
* @throws ProvisionedThroughputExceededException
@@ -802,8 +789,7 @@ public function scan($input): ScanOutput
802789
*
803790
* @param array{
804791
* TableName: string,
805-
*
806-
* @region?: string,
792+
* '@region'?: string|null,
807793
* }|DescribeTableInput $input
808794
*/
809795
public function tableExists($input): TableExistsWaiter
@@ -822,8 +808,7 @@ public function tableExists($input): TableExistsWaiter
822808
*
823809
* @param array{
824810
* TableName: string,
825-
*
826-
* @region?: string,
811+
* '@region'?: string|null,
827812
* }|DescribeTableInput $input
828813
*/
829814
public function tableNotExists($input): TableNotExistsWaiter
@@ -881,8 +866,7 @@ public function tableNotExists($input): TableNotExistsWaiter
881866
* ReturnConsumedCapacity?: ReturnConsumedCapacity::*,
882867
* ReturnItemCollectionMetrics?: ReturnItemCollectionMetrics::*,
883868
* ClientRequestToken?: string,
884-
*
885-
* @region?: string,
869+
* '@region'?: string|null,
886870
* }|TransactWriteItemsInput $input
887871
*
888872
* @throws ResourceNotFoundException
@@ -934,8 +918,7 @@ public function transactWriteItems($input): TransactWriteItemsOutput
934918
* ConditionExpression?: string,
935919
* ExpressionAttributeNames?: array<string, string>,
936920
* ExpressionAttributeValues?: array<string, AttributeValue>,
937-
*
938-
* @region?: string,
921+
* '@region'?: string|null,
939922
* }|UpdateItemInput $input
940923
*
941924
* @throws ConditionalCheckFailedException
@@ -995,8 +978,7 @@ public function updateItem($input): UpdateItemOutput
995978
* ReplicaUpdates?: ReplicationGroupUpdate[],
996979
* TableClass?: TableClass::*,
997980
* DeletionProtectionEnabled?: bool,
998-
*
999-
* @region?: string,
981+
* '@region'?: string|null,
1000982
* }|UpdateTableInput $input
1001983
*
1002984
* @throws ResourceInUseException
@@ -1048,8 +1030,7 @@ public function updateTable($input): UpdateTableOutput
10481030
* @param array{
10491031
* TableName: string,
10501032
* TimeToLiveSpecification: TimeToLiveSpecification|array,
1051-
*
1052-
* @region?: string,
1033+
* '@region'?: string|null,
10531034
* }|UpdateTimeToLiveInput $input
10541035
*
10551036
* @throws ResourceInUseException

src/Input/BatchGetItemInput.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ final class BatchGetItemInput extends Input
8383
* @param array{
8484
* RequestItems?: array<string, KeysAndAttributes>,
8585
* ReturnConsumedCapacity?: ReturnConsumedCapacity::*,
86-
*
87-
* @region?: string,
86+
* '@region'?: string|null,
8887
* } $input
8988
*/
9089
public function __construct(array $input = [])

src/Input/BatchWriteItemInput.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ final class BatchWriteItemInput extends Input
6363
* RequestItems?: array<string, array>,
6464
* ReturnConsumedCapacity?: ReturnConsumedCapacity::*,
6565
* ReturnItemCollectionMetrics?: ReturnItemCollectionMetrics::*,
66-
*
67-
* @region?: string,
66+
* '@region'?: string|null,
6867
* } $input
6968
*/
7069
public function __construct(array $input = [])

src/Input/CreateTableInput.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@ final class CreateTableInput extends Input
232232
* Tags?: Tag[],
233233
* TableClass?: TableClass::*,
234234
* DeletionProtectionEnabled?: bool,
235-
*
236-
* @region?: string,
235+
* '@region'?: string|null,
237236
* } $input
238237
*/
239238
public function __construct(array $input = [])

src/Input/DeleteItemInput.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ final class DeleteItemInput extends Input
185185
* ConditionExpression?: string,
186186
* ExpressionAttributeNames?: array<string, string>,
187187
* ExpressionAttributeValues?: array<string, AttributeValue>,
188-
*
189-
* @region?: string,
188+
* '@region'?: string|null,
190189
* } $input
191190
*/
192191
public function __construct(array $input = [])

src/Input/DeleteTableInput.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ final class DeleteTableInput extends Input
2424
/**
2525
* @param array{
2626
* TableName?: string,
27-
*
28-
* @region?: string,
27+
* '@region'?: string|null,
2928
* } $input
3029
*/
3130
public function __construct(array $input = [])

src/Input/DescribeEndpointsRequest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ final class DescribeEndpointsRequest extends Input
1010
{
1111
/**
1212
* @param array{
13-
*
14-
* @region?: string,
13+
* '@region'?: string|null,
1514
* } $input
1615
*/
1716
public function __construct(array $input = [])

src/Input/DescribeTableInput.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ final class DescribeTableInput extends Input
2424
/**
2525
* @param array{
2626
* TableName?: string,
27-
*
28-
* @region?: string,
27+
* '@region'?: string|null,
2928
* } $input
3029
*/
3130
public function __construct(array $input = [])

src/Input/ExecuteStatementInput.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ final class ExecuteStatementInput extends Input
6767
* NextToken?: string,
6868
* ReturnConsumedCapacity?: ReturnConsumedCapacity::*,
6969
* Limit?: int,
70-
*
71-
* @region?: string,
70+
* '@region'?: string|null,
7271
* } $input
7372
*/
7473
public function __construct(array $input = [])

src/Input/GetItemInput.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ final class GetItemInput extends Input
119119
* ReturnConsumedCapacity?: ReturnConsumedCapacity::*,
120120
* ProjectionExpression?: string,
121121
* ExpressionAttributeNames?: array<string, string>,
122-
*
123-
* @region?: string,
122+
* '@region'?: string|null,
124123
* } $input
125124
*/
126125
public function __construct(array $input = [])

0 commit comments

Comments
 (0)