Skip to content

Commit bbd8e4e

Browse files
authored
Initialize ObjectValue with null (#1085)
1 parent 4fdb8df commit bbd8e4e

12 files changed

+64
-64
lines changed

src/Result/BatchGetItemOutput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ private function populateResultConsumedCapacityMultiple(array $json): array
176176
'WriteCapacityUnits' => isset($item['Table']['WriteCapacityUnits']) ? (float) $item['Table']['WriteCapacityUnits'] : null,
177177
'CapacityUnits' => isset($item['Table']['CapacityUnits']) ? (float) $item['Table']['CapacityUnits'] : null,
178178
]),
179-
'LocalSecondaryIndexes' => empty($item['LocalSecondaryIndexes']) ? [] : $this->populateResultSecondaryIndexesCapacityMap($item['LocalSecondaryIndexes']),
180-
'GlobalSecondaryIndexes' => empty($item['GlobalSecondaryIndexes']) ? [] : $this->populateResultSecondaryIndexesCapacityMap($item['GlobalSecondaryIndexes']),
179+
'LocalSecondaryIndexes' => !isset($item['LocalSecondaryIndexes']) ? null : $this->populateResultSecondaryIndexesCapacityMap($item['LocalSecondaryIndexes']),
180+
'GlobalSecondaryIndexes' => !isset($item['GlobalSecondaryIndexes']) ? null : $this->populateResultSecondaryIndexesCapacityMap($item['GlobalSecondaryIndexes']),
181181
]);
182182
}
183183

src/Result/BatchWriteItemOutput.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ private function populateResultConsumedCapacityMultiple(array $json): array
104104
'WriteCapacityUnits' => isset($item['Table']['WriteCapacityUnits']) ? (float) $item['Table']['WriteCapacityUnits'] : null,
105105
'CapacityUnits' => isset($item['Table']['CapacityUnits']) ? (float) $item['Table']['CapacityUnits'] : null,
106106
]),
107-
'LocalSecondaryIndexes' => empty($item['LocalSecondaryIndexes']) ? [] : $this->populateResultSecondaryIndexesCapacityMap($item['LocalSecondaryIndexes']),
108-
'GlobalSecondaryIndexes' => empty($item['GlobalSecondaryIndexes']) ? [] : $this->populateResultSecondaryIndexesCapacityMap($item['GlobalSecondaryIndexes']),
107+
'LocalSecondaryIndexes' => !isset($item['LocalSecondaryIndexes']) ? null : $this->populateResultSecondaryIndexesCapacityMap($item['LocalSecondaryIndexes']),
108+
'GlobalSecondaryIndexes' => !isset($item['GlobalSecondaryIndexes']) ? null : $this->populateResultSecondaryIndexesCapacityMap($item['GlobalSecondaryIndexes']),
109109
]);
110110
}
111111

@@ -133,8 +133,8 @@ private function populateResultItemCollectionMetricsMultiple(array $json): array
133133
$items = [];
134134
foreach ($json as $item) {
135135
$items[] = new ItemCollectionMetrics([
136-
'ItemCollectionKey' => empty($item['ItemCollectionKey']) ? [] : $this->populateResultItemCollectionKeyAttributeMap($item['ItemCollectionKey']),
137-
'SizeEstimateRangeGB' => empty($item['SizeEstimateRangeGB']) ? [] : $this->populateResultItemCollectionSizeEstimateRange($item['SizeEstimateRangeGB']),
136+
'ItemCollectionKey' => !isset($item['ItemCollectionKey']) ? null : $this->populateResultItemCollectionKeyAttributeMap($item['ItemCollectionKey']),
137+
'SizeEstimateRangeGB' => !isset($item['SizeEstimateRangeGB']) ? null : $this->populateResultItemCollectionSizeEstimateRange($item['SizeEstimateRangeGB']),
138138
]);
139139
}
140140

src/Result/CreateTableOutput.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ protected function populateResult(Response $response): void
4242
$data = $response->toArray();
4343

4444
$this->tableDescription = empty($data['TableDescription']) ? null : new TableDescription([
45-
'AttributeDefinitions' => empty($data['TableDescription']['AttributeDefinitions']) ? [] : $this->populateResultAttributeDefinitions($data['TableDescription']['AttributeDefinitions']),
45+
'AttributeDefinitions' => !isset($data['TableDescription']['AttributeDefinitions']) ? null : $this->populateResultAttributeDefinitions($data['TableDescription']['AttributeDefinitions']),
4646
'TableName' => isset($data['TableDescription']['TableName']) ? (string) $data['TableDescription']['TableName'] : null,
47-
'KeySchema' => empty($data['TableDescription']['KeySchema']) ? [] : $this->populateResultKeySchema($data['TableDescription']['KeySchema']),
47+
'KeySchema' => !isset($data['TableDescription']['KeySchema']) ? null : $this->populateResultKeySchema($data['TableDescription']['KeySchema']),
4848
'TableStatus' => isset($data['TableDescription']['TableStatus']) ? (string) $data['TableDescription']['TableStatus'] : null,
4949
'CreationDateTime' => (isset($data['TableDescription']['CreationDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $data['TableDescription']['CreationDateTime'])))) ? $d : null,
5050
'ProvisionedThroughput' => empty($data['TableDescription']['ProvisionedThroughput']) ? null : new ProvisionedThroughputDescription([
@@ -62,16 +62,16 @@ protected function populateResult(Response $response): void
6262
'BillingMode' => isset($data['TableDescription']['BillingModeSummary']['BillingMode']) ? (string) $data['TableDescription']['BillingModeSummary']['BillingMode'] : null,
6363
'LastUpdateToPayPerRequestDateTime' => (isset($data['TableDescription']['BillingModeSummary']['LastUpdateToPayPerRequestDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $data['TableDescription']['BillingModeSummary']['LastUpdateToPayPerRequestDateTime'])))) ? $d : null,
6464
]),
65-
'LocalSecondaryIndexes' => empty($data['TableDescription']['LocalSecondaryIndexes']) ? [] : $this->populateResultLocalSecondaryIndexDescriptionList($data['TableDescription']['LocalSecondaryIndexes']),
66-
'GlobalSecondaryIndexes' => empty($data['TableDescription']['GlobalSecondaryIndexes']) ? [] : $this->populateResultGlobalSecondaryIndexDescriptionList($data['TableDescription']['GlobalSecondaryIndexes']),
65+
'LocalSecondaryIndexes' => !isset($data['TableDescription']['LocalSecondaryIndexes']) ? null : $this->populateResultLocalSecondaryIndexDescriptionList($data['TableDescription']['LocalSecondaryIndexes']),
66+
'GlobalSecondaryIndexes' => !isset($data['TableDescription']['GlobalSecondaryIndexes']) ? null : $this->populateResultGlobalSecondaryIndexDescriptionList($data['TableDescription']['GlobalSecondaryIndexes']),
6767
'StreamSpecification' => empty($data['TableDescription']['StreamSpecification']) ? null : new StreamSpecification([
6868
'StreamEnabled' => filter_var($data['TableDescription']['StreamSpecification']['StreamEnabled'], \FILTER_VALIDATE_BOOLEAN),
6969
'StreamViewType' => isset($data['TableDescription']['StreamSpecification']['StreamViewType']) ? (string) $data['TableDescription']['StreamSpecification']['StreamViewType'] : null,
7070
]),
7171
'LatestStreamLabel' => isset($data['TableDescription']['LatestStreamLabel']) ? (string) $data['TableDescription']['LatestStreamLabel'] : null,
7272
'LatestStreamArn' => isset($data['TableDescription']['LatestStreamArn']) ? (string) $data['TableDescription']['LatestStreamArn'] : null,
7373
'GlobalTableVersion' => isset($data['TableDescription']['GlobalTableVersion']) ? (string) $data['TableDescription']['GlobalTableVersion'] : null,
74-
'Replicas' => empty($data['TableDescription']['Replicas']) ? [] : $this->populateResultReplicaDescriptionList($data['TableDescription']['Replicas']),
74+
'Replicas' => !isset($data['TableDescription']['Replicas']) ? null : $this->populateResultReplicaDescriptionList($data['TableDescription']['Replicas']),
7575
'RestoreSummary' => empty($data['TableDescription']['RestoreSummary']) ? null : new RestoreSummary([
7676
'SourceBackupArn' => isset($data['TableDescription']['RestoreSummary']['SourceBackupArn']) ? (string) $data['TableDescription']['RestoreSummary']['SourceBackupArn'] : null,
7777
'SourceTableArn' => isset($data['TableDescription']['RestoreSummary']['SourceTableArn']) ? (string) $data['TableDescription']['RestoreSummary']['SourceTableArn'] : null,
@@ -117,10 +117,10 @@ private function populateResultGlobalSecondaryIndexDescriptionList(array $json):
117117
foreach ($json as $item) {
118118
$items[] = new GlobalSecondaryIndexDescription([
119119
'IndexName' => isset($item['IndexName']) ? (string) $item['IndexName'] : null,
120-
'KeySchema' => empty($item['KeySchema']) ? [] : $this->populateResultKeySchema($item['KeySchema']),
120+
'KeySchema' => !isset($item['KeySchema']) ? null : $this->populateResultKeySchema($item['KeySchema']),
121121
'Projection' => empty($item['Projection']) ? null : new Projection([
122122
'ProjectionType' => isset($item['Projection']['ProjectionType']) ? (string) $item['Projection']['ProjectionType'] : null,
123-
'NonKeyAttributes' => empty($item['Projection']['NonKeyAttributes']) ? [] : $this->populateResultNonKeyAttributeNameList($item['Projection']['NonKeyAttributes']),
123+
'NonKeyAttributes' => !isset($item['Projection']['NonKeyAttributes']) ? null : $this->populateResultNonKeyAttributeNameList($item['Projection']['NonKeyAttributes']),
124124
]),
125125
'IndexStatus' => isset($item['IndexStatus']) ? (string) $item['IndexStatus'] : null,
126126
'Backfilling' => isset($item['Backfilling']) ? filter_var($item['Backfilling'], \FILTER_VALIDATE_BOOLEAN) : null,
@@ -165,10 +165,10 @@ private function populateResultLocalSecondaryIndexDescriptionList(array $json):
165165
foreach ($json as $item) {
166166
$items[] = new LocalSecondaryIndexDescription([
167167
'IndexName' => isset($item['IndexName']) ? (string) $item['IndexName'] : null,
168-
'KeySchema' => empty($item['KeySchema']) ? [] : $this->populateResultKeySchema($item['KeySchema']),
168+
'KeySchema' => !isset($item['KeySchema']) ? null : $this->populateResultKeySchema($item['KeySchema']),
169169
'Projection' => empty($item['Projection']) ? null : new Projection([
170170
'ProjectionType' => isset($item['Projection']['ProjectionType']) ? (string) $item['Projection']['ProjectionType'] : null,
171-
'NonKeyAttributes' => empty($item['Projection']['NonKeyAttributes']) ? [] : $this->populateResultNonKeyAttributeNameList($item['Projection']['NonKeyAttributes']),
171+
'NonKeyAttributes' => !isset($item['Projection']['NonKeyAttributes']) ? null : $this->populateResultNonKeyAttributeNameList($item['Projection']['NonKeyAttributes']),
172172
]),
173173
'IndexSizeBytes' => isset($item['IndexSizeBytes']) ? (string) $item['IndexSizeBytes'] : null,
174174
'ItemCount' => isset($item['ItemCount']) ? (string) $item['ItemCount'] : null,
@@ -211,7 +211,7 @@ private function populateResultReplicaDescriptionList(array $json): array
211211
'ProvisionedThroughputOverride' => empty($item['ProvisionedThroughputOverride']) ? null : new ProvisionedThroughputOverride([
212212
'ReadCapacityUnits' => isset($item['ProvisionedThroughputOverride']['ReadCapacityUnits']) ? (string) $item['ProvisionedThroughputOverride']['ReadCapacityUnits'] : null,
213213
]),
214-
'GlobalSecondaryIndexes' => empty($item['GlobalSecondaryIndexes']) ? [] : $this->populateResultReplicaGlobalSecondaryIndexDescriptionList($item['GlobalSecondaryIndexes']),
214+
'GlobalSecondaryIndexes' => !isset($item['GlobalSecondaryIndexes']) ? null : $this->populateResultReplicaGlobalSecondaryIndexDescriptionList($item['GlobalSecondaryIndexes']),
215215
'ReplicaInaccessibleDateTime' => (isset($item['ReplicaInaccessibleDateTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $item['ReplicaInaccessibleDateTime'])))) ? $d : null,
216216
]);
217217
}

src/Result/DeleteItemOutput.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ protected function populateResult(Response $response): void
7676
'WriteCapacityUnits' => isset($data['ConsumedCapacity']['Table']['WriteCapacityUnits']) ? (float) $data['ConsumedCapacity']['Table']['WriteCapacityUnits'] : null,
7777
'CapacityUnits' => isset($data['ConsumedCapacity']['Table']['CapacityUnits']) ? (float) $data['ConsumedCapacity']['Table']['CapacityUnits'] : null,
7878
]),
79-
'LocalSecondaryIndexes' => empty($data['ConsumedCapacity']['LocalSecondaryIndexes']) ? [] : $this->populateResultSecondaryIndexesCapacityMap($data['ConsumedCapacity']['LocalSecondaryIndexes']),
80-
'GlobalSecondaryIndexes' => empty($data['ConsumedCapacity']['GlobalSecondaryIndexes']) ? [] : $this->populateResultSecondaryIndexesCapacityMap($data['ConsumedCapacity']['GlobalSecondaryIndexes']),
79+
'LocalSecondaryIndexes' => !isset($data['ConsumedCapacity']['LocalSecondaryIndexes']) ? null : $this->populateResultSecondaryIndexesCapacityMap($data['ConsumedCapacity']['LocalSecondaryIndexes']),
80+
'GlobalSecondaryIndexes' => !isset($data['ConsumedCapacity']['GlobalSecondaryIndexes']) ? null : $this->populateResultSecondaryIndexesCapacityMap($data['ConsumedCapacity']['GlobalSecondaryIndexes']),
8181
]);
8282
$this->itemCollectionMetrics = empty($data['ItemCollectionMetrics']) ? null : new ItemCollectionMetrics([
83-
'ItemCollectionKey' => empty($data['ItemCollectionMetrics']['ItemCollectionKey']) ? [] : $this->populateResultItemCollectionKeyAttributeMap($data['ItemCollectionMetrics']['ItemCollectionKey']),
84-
'SizeEstimateRangeGB' => empty($data['ItemCollectionMetrics']['SizeEstimateRangeGB']) ? [] : $this->populateResultItemCollectionSizeEstimateRange($data['ItemCollectionMetrics']['SizeEstimateRangeGB']),
83+
'ItemCollectionKey' => !isset($data['ItemCollectionMetrics']['ItemCollectionKey']) ? null : $this->populateResultItemCollectionKeyAttributeMap($data['ItemCollectionMetrics']['ItemCollectionKey']),
84+
'SizeEstimateRangeGB' => !isset($data['ItemCollectionMetrics']['SizeEstimateRangeGB']) ? null : $this->populateResultItemCollectionSizeEstimateRange($data['ItemCollectionMetrics']['SizeEstimateRangeGB']),
8585
]);
8686
}
8787

0 commit comments

Comments
 (0)