Skip to content

Commit b3c86e7

Browse files
authored
Use int as the PHP representation of long fields in generated code (#1471)
* Use int as the PHP representation of long fields in generated code * Add changelog entries for signature changes affecting strict types * Remove generator hacks needed for endpoint shapes to force the type Now that long fields are always defined as integer, we don't need such hacks anymore
1 parent 5fb219a commit b3c86e7

14 files changed

+89
-80
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
## NOT RELEASED
44

5+
### BC-BREAK
6+
7+
- The return type for the methods `getIndexSizeBytes` and `getItemCount` of `\AsyncAws\DynamoDb\ValueObject\GlobalSecondaryIndexDescription` uses `int` instead of `string` to reflect the AWS type.
8+
- The return type for the methods `getIndexSizeBytes` and `getItemCount` of `\AsyncAws\DynamoDb\ValueObject\LocalSecondaryIndexDescription` uses `int` instead of `string` to reflect the AWS type.
9+
- The return type for the methods `getReadCapacityUnits` and `getWriteCapacityUnits` of `\AsyncAws\DynamoDb\ValueObject\ProvisionedThroughput` uses `int` instead of `string` to reflect the AWS type.
10+
- The return type for the methods `getNumberOfDecreasesToday`, `getReadCapacityUnits` and `getWriteCapacityUnits` of `\AsyncAws\DynamoDb\ValueObject\ProvisionedThroughputDescription` uses `int` instead of `string` to reflect the AWS type.
11+
- The return type for `\AsyncAws\DynamoDb\ValueObject\ProvisionedThroughputOverride::getReadCapacityUnits` uses `int` instead of `string` to reflect the AWS type.
12+
- The return type for the methods `getItemCount` and `getTableSizeBytes` of `\AsyncAws\DynamoDb\ValueObject\TableDescription` uses `int` instead of `string` to reflect the AWS type.
13+
514
### Added
615

716
- AWS enhancement: Documentation updates.

src/Result/CreateTableOutput.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ private function populateResultGlobalSecondaryIndexDescription(array $json): Glo
9292
'IndexStatus' => isset($json['IndexStatus']) ? (string) $json['IndexStatus'] : null,
9393
'Backfilling' => isset($json['Backfilling']) ? filter_var($json['Backfilling'], \FILTER_VALIDATE_BOOLEAN) : null,
9494
'ProvisionedThroughput' => empty($json['ProvisionedThroughput']) ? null : $this->populateResultProvisionedThroughputDescription($json['ProvisionedThroughput']),
95-
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (string) $json['IndexSizeBytes'] : null,
96-
'ItemCount' => isset($json['ItemCount']) ? (string) $json['ItemCount'] : null,
95+
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (int) $json['IndexSizeBytes'] : null,
96+
'ItemCount' => isset($json['ItemCount']) ? (int) $json['ItemCount'] : null,
9797
'IndexArn' => isset($json['IndexArn']) ? (string) $json['IndexArn'] : null,
9898
]);
9999
}
@@ -138,8 +138,8 @@ private function populateResultLocalSecondaryIndexDescription(array $json): Loca
138138
'IndexName' => isset($json['IndexName']) ? (string) $json['IndexName'] : null,
139139
'KeySchema' => !isset($json['KeySchema']) ? null : $this->populateResultKeySchema($json['KeySchema']),
140140
'Projection' => empty($json['Projection']) ? null : $this->populateResultProjection($json['Projection']),
141-
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (string) $json['IndexSizeBytes'] : null,
142-
'ItemCount' => isset($json['ItemCount']) ? (string) $json['ItemCount'] : null,
141+
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (int) $json['IndexSizeBytes'] : null,
142+
'ItemCount' => isset($json['ItemCount']) ? (int) $json['ItemCount'] : null,
143143
'IndexArn' => isset($json['IndexArn']) ? (string) $json['IndexArn'] : null,
144144
]);
145145
}
@@ -186,16 +186,16 @@ private function populateResultProvisionedThroughputDescription(array $json): Pr
186186
return new ProvisionedThroughputDescription([
187187
'LastIncreaseDateTime' => (isset($json['LastIncreaseDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['LastIncreaseDateTime'])))) ? $d : null,
188188
'LastDecreaseDateTime' => (isset($json['LastDecreaseDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['LastDecreaseDateTime'])))) ? $d : null,
189-
'NumberOfDecreasesToday' => isset($json['NumberOfDecreasesToday']) ? (string) $json['NumberOfDecreasesToday'] : null,
190-
'ReadCapacityUnits' => isset($json['ReadCapacityUnits']) ? (string) $json['ReadCapacityUnits'] : null,
191-
'WriteCapacityUnits' => isset($json['WriteCapacityUnits']) ? (string) $json['WriteCapacityUnits'] : null,
189+
'NumberOfDecreasesToday' => isset($json['NumberOfDecreasesToday']) ? (int) $json['NumberOfDecreasesToday'] : null,
190+
'ReadCapacityUnits' => isset($json['ReadCapacityUnits']) ? (int) $json['ReadCapacityUnits'] : null,
191+
'WriteCapacityUnits' => isset($json['WriteCapacityUnits']) ? (int) $json['WriteCapacityUnits'] : null,
192192
]);
193193
}
194194

195195
private function populateResultProvisionedThroughputOverride(array $json): ProvisionedThroughputOverride
196196
{
197197
return new ProvisionedThroughputOverride([
198-
'ReadCapacityUnits' => isset($json['ReadCapacityUnits']) ? (string) $json['ReadCapacityUnits'] : null,
198+
'ReadCapacityUnits' => isset($json['ReadCapacityUnits']) ? (int) $json['ReadCapacityUnits'] : null,
199199
]);
200200
}
201201

@@ -293,8 +293,8 @@ private function populateResultTableDescription(array $json): TableDescription
293293
'TableStatus' => isset($json['TableStatus']) ? (string) $json['TableStatus'] : null,
294294
'CreationDateTime' => (isset($json['CreationDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['CreationDateTime'])))) ? $d : null,
295295
'ProvisionedThroughput' => empty($json['ProvisionedThroughput']) ? null : $this->populateResultProvisionedThroughputDescription($json['ProvisionedThroughput']),
296-
'TableSizeBytes' => isset($json['TableSizeBytes']) ? (string) $json['TableSizeBytes'] : null,
297-
'ItemCount' => isset($json['ItemCount']) ? (string) $json['ItemCount'] : null,
296+
'TableSizeBytes' => isset($json['TableSizeBytes']) ? (int) $json['TableSizeBytes'] : null,
297+
'ItemCount' => isset($json['ItemCount']) ? (int) $json['ItemCount'] : null,
298298
'TableArn' => isset($json['TableArn']) ? (string) $json['TableArn'] : null,
299299
'TableId' => isset($json['TableId']) ? (string) $json['TableId'] : null,
300300
'BillingModeSummary' => empty($json['BillingModeSummary']) ? null : $this->populateResultBillingModeSummary($json['BillingModeSummary']),

src/Result/DeleteTableOutput.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ private function populateResultGlobalSecondaryIndexDescription(array $json): Glo
9292
'IndexStatus' => isset($json['IndexStatus']) ? (string) $json['IndexStatus'] : null,
9393
'Backfilling' => isset($json['Backfilling']) ? filter_var($json['Backfilling'], \FILTER_VALIDATE_BOOLEAN) : null,
9494
'ProvisionedThroughput' => empty($json['ProvisionedThroughput']) ? null : $this->populateResultProvisionedThroughputDescription($json['ProvisionedThroughput']),
95-
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (string) $json['IndexSizeBytes'] : null,
96-
'ItemCount' => isset($json['ItemCount']) ? (string) $json['ItemCount'] : null,
95+
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (int) $json['IndexSizeBytes'] : null,
96+
'ItemCount' => isset($json['ItemCount']) ? (int) $json['ItemCount'] : null,
9797
'IndexArn' => isset($json['IndexArn']) ? (string) $json['IndexArn'] : null,
9898
]);
9999
}
@@ -138,8 +138,8 @@ private function populateResultLocalSecondaryIndexDescription(array $json): Loca
138138
'IndexName' => isset($json['IndexName']) ? (string) $json['IndexName'] : null,
139139
'KeySchema' => !isset($json['KeySchema']) ? null : $this->populateResultKeySchema($json['KeySchema']),
140140
'Projection' => empty($json['Projection']) ? null : $this->populateResultProjection($json['Projection']),
141-
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (string) $json['IndexSizeBytes'] : null,
142-
'ItemCount' => isset($json['ItemCount']) ? (string) $json['ItemCount'] : null,
141+
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (int) $json['IndexSizeBytes'] : null,
142+
'ItemCount' => isset($json['ItemCount']) ? (int) $json['ItemCount'] : null,
143143
'IndexArn' => isset($json['IndexArn']) ? (string) $json['IndexArn'] : null,
144144
]);
145145
}
@@ -186,16 +186,16 @@ private function populateResultProvisionedThroughputDescription(array $json): Pr
186186
return new ProvisionedThroughputDescription([
187187
'LastIncreaseDateTime' => (isset($json['LastIncreaseDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['LastIncreaseDateTime'])))) ? $d : null,
188188
'LastDecreaseDateTime' => (isset($json['LastDecreaseDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['LastDecreaseDateTime'])))) ? $d : null,
189-
'NumberOfDecreasesToday' => isset($json['NumberOfDecreasesToday']) ? (string) $json['NumberOfDecreasesToday'] : null,
190-
'ReadCapacityUnits' => isset($json['ReadCapacityUnits']) ? (string) $json['ReadCapacityUnits'] : null,
191-
'WriteCapacityUnits' => isset($json['WriteCapacityUnits']) ? (string) $json['WriteCapacityUnits'] : null,
189+
'NumberOfDecreasesToday' => isset($json['NumberOfDecreasesToday']) ? (int) $json['NumberOfDecreasesToday'] : null,
190+
'ReadCapacityUnits' => isset($json['ReadCapacityUnits']) ? (int) $json['ReadCapacityUnits'] : null,
191+
'WriteCapacityUnits' => isset($json['WriteCapacityUnits']) ? (int) $json['WriteCapacityUnits'] : null,
192192
]);
193193
}
194194

195195
private function populateResultProvisionedThroughputOverride(array $json): ProvisionedThroughputOverride
196196
{
197197
return new ProvisionedThroughputOverride([
198-
'ReadCapacityUnits' => isset($json['ReadCapacityUnits']) ? (string) $json['ReadCapacityUnits'] : null,
198+
'ReadCapacityUnits' => isset($json['ReadCapacityUnits']) ? (int) $json['ReadCapacityUnits'] : null,
199199
]);
200200
}
201201

@@ -293,8 +293,8 @@ private function populateResultTableDescription(array $json): TableDescription
293293
'TableStatus' => isset($json['TableStatus']) ? (string) $json['TableStatus'] : null,
294294
'CreationDateTime' => (isset($json['CreationDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['CreationDateTime'])))) ? $d : null,
295295
'ProvisionedThroughput' => empty($json['ProvisionedThroughput']) ? null : $this->populateResultProvisionedThroughputDescription($json['ProvisionedThroughput']),
296-
'TableSizeBytes' => isset($json['TableSizeBytes']) ? (string) $json['TableSizeBytes'] : null,
297-
'ItemCount' => isset($json['ItemCount']) ? (string) $json['ItemCount'] : null,
296+
'TableSizeBytes' => isset($json['TableSizeBytes']) ? (int) $json['TableSizeBytes'] : null,
297+
'ItemCount' => isset($json['ItemCount']) ? (int) $json['ItemCount'] : null,
298298
'TableArn' => isset($json['TableArn']) ? (string) $json['TableArn'] : null,
299299
'TableId' => isset($json['TableId']) ? (string) $json['TableId'] : null,
300300
'BillingModeSummary' => empty($json['BillingModeSummary']) ? null : $this->populateResultBillingModeSummary($json['BillingModeSummary']),

src/Result/DescribeEndpointsResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private function populateResultEndpoint(array $json): Endpoint
3434
{
3535
return new Endpoint([
3636
'Address' => (string) $json['Address'],
37-
'CachePeriodInMinutes' => (string) $json['CachePeriodInMinutes'],
37+
'CachePeriodInMinutes' => (int) $json['CachePeriodInMinutes'],
3838
]);
3939
}
4040

src/Result/DescribeTableOutput.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ private function populateResultGlobalSecondaryIndexDescription(array $json): Glo
9292
'IndexStatus' => isset($json['IndexStatus']) ? (string) $json['IndexStatus'] : null,
9393
'Backfilling' => isset($json['Backfilling']) ? filter_var($json['Backfilling'], \FILTER_VALIDATE_BOOLEAN) : null,
9494
'ProvisionedThroughput' => empty($json['ProvisionedThroughput']) ? null : $this->populateResultProvisionedThroughputDescription($json['ProvisionedThroughput']),
95-
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (string) $json['IndexSizeBytes'] : null,
96-
'ItemCount' => isset($json['ItemCount']) ? (string) $json['ItemCount'] : null,
95+
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (int) $json['IndexSizeBytes'] : null,
96+
'ItemCount' => isset($json['ItemCount']) ? (int) $json['ItemCount'] : null,
9797
'IndexArn' => isset($json['IndexArn']) ? (string) $json['IndexArn'] : null,
9898
]);
9999
}
@@ -138,8 +138,8 @@ private function populateResultLocalSecondaryIndexDescription(array $json): Loca
138138
'IndexName' => isset($json['IndexName']) ? (string) $json['IndexName'] : null,
139139
'KeySchema' => !isset($json['KeySchema']) ? null : $this->populateResultKeySchema($json['KeySchema']),
140140
'Projection' => empty($json['Projection']) ? null : $this->populateResultProjection($json['Projection']),
141-
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (string) $json['IndexSizeBytes'] : null,
142-
'ItemCount' => isset($json['ItemCount']) ? (string) $json['ItemCount'] : null,
141+
'IndexSizeBytes' => isset($json['IndexSizeBytes']) ? (int) $json['IndexSizeBytes'] : null,
142+
'ItemCount' => isset($json['ItemCount']) ? (int) $json['ItemCount'] : null,
143143
'IndexArn' => isset($json['IndexArn']) ? (string) $json['IndexArn'] : null,
144144
]);
145145
}
@@ -186,16 +186,16 @@ private function populateResultProvisionedThroughputDescription(array $json): Pr
186186
return new ProvisionedThroughputDescription([
187187
'LastIncreaseDateTime' => (isset($json['LastIncreaseDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['LastIncreaseDateTime'])))) ? $d : null,
188188
'LastDecreaseDateTime' => (isset($json['LastDecreaseDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['LastDecreaseDateTime'])))) ? $d : null,
189-
'NumberOfDecreasesToday' => isset($json['NumberOfDecreasesToday']) ? (string) $json['NumberOfDecreasesToday'] : null,
190-
'ReadCapacityUnits' => isset($json['ReadCapacityUnits']) ? (string) $json['ReadCapacityUnits'] : null,
191-
'WriteCapacityUnits' => isset($json['WriteCapacityUnits']) ? (string) $json['WriteCapacityUnits'] : null,
189+
'NumberOfDecreasesToday' => isset($json['NumberOfDecreasesToday']) ? (int) $json['NumberOfDecreasesToday'] : null,
190+
'ReadCapacityUnits' => isset($json['ReadCapacityUnits']) ? (int) $json['ReadCapacityUnits'] : null,
191+
'WriteCapacityUnits' => isset($json['WriteCapacityUnits']) ? (int) $json['WriteCapacityUnits'] : null,
192192
]);
193193
}
194194

195195
private function populateResultProvisionedThroughputOverride(array $json): ProvisionedThroughputOverride
196196
{
197197
return new ProvisionedThroughputOverride([
198-
'ReadCapacityUnits' => isset($json['ReadCapacityUnits']) ? (string) $json['ReadCapacityUnits'] : null,
198+
'ReadCapacityUnits' => isset($json['ReadCapacityUnits']) ? (int) $json['ReadCapacityUnits'] : null,
199199
]);
200200
}
201201

@@ -293,8 +293,8 @@ private function populateResultTableDescription(array $json): TableDescription
293293
'TableStatus' => isset($json['TableStatus']) ? (string) $json['TableStatus'] : null,
294294
'CreationDateTime' => (isset($json['CreationDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['CreationDateTime'])))) ? $d : null,
295295
'ProvisionedThroughput' => empty($json['ProvisionedThroughput']) ? null : $this->populateResultProvisionedThroughputDescription($json['ProvisionedThroughput']),
296-
'TableSizeBytes' => isset($json['TableSizeBytes']) ? (string) $json['TableSizeBytes'] : null,
297-
'ItemCount' => isset($json['ItemCount']) ? (string) $json['ItemCount'] : null,
296+
'TableSizeBytes' => isset($json['TableSizeBytes']) ? (int) $json['TableSizeBytes'] : null,
297+
'ItemCount' => isset($json['ItemCount']) ? (int) $json['ItemCount'] : null,
298298
'TableArn' => isset($json['TableArn']) ? (string) $json['TableArn'] : null,
299299
'TableId' => isset($json['TableId']) ? (string) $json['TableId'] : null,
300300
'BillingModeSummary' => empty($json['BillingModeSummary']) ? null : $this->populateResultBillingModeSummary($json['BillingModeSummary']),

0 commit comments

Comments
 (0)