Skip to content

Commit eb38b8c

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 3e15515 commit eb38b8c

14 files changed

+39
-30
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 type for `\AsyncAws\Lambda\Input\AddLayerVersionPermissionRequest::getVersionNumber` and `\AsyncAws\Lambda\Input\AddLayerVersionPermissionRequest::setVersionNumber` uses `int` instead of `string` to reflect the AWS type.
8+
- The return type for `\AsyncAws\Lambda\Result\PublishLayerVersionResponse::getVersion` uses `int` instead of `string` to reflect the AWS type.
9+
- The return type for `\AsyncAws\Lambda\ValueObject\FunctionConfiguration::getCodeSize` uses `int` instead of `string` to reflect the AWS type.
10+
- The return type for `\AsyncAws\Lambda\ValueObject\Layer::getCodeSize` uses `int` instead of `string` to reflect the AWS type.
11+
- The return type for `\AsyncAws\Lambda\ValueObject\LayerVersionContentOutput::getCodeSize` uses `int` instead of `string` to reflect the AWS type.
12+
- The return type for `\AsyncAws\Lambda\ValueObject\LayerVersionsListItem::getVersion` uses `int` instead of `string` to reflect the AWS type.
13+
514
### Added
615

716
- AWS api-change: This release adds RecursiveInvocationException to the Invoke API and InvokeWithResponseStream API.

src/Input/AddLayerVersionPermissionRequest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class AddLayerVersionPermissionRequest extends Input
2323
*
2424
* @required
2525
*
26-
* @var string|null
26+
* @var int|null
2727
*/
2828
private $versionNumber;
2929

@@ -74,7 +74,7 @@ final class AddLayerVersionPermissionRequest extends Input
7474
/**
7575
* @param array{
7676
* LayerName?: string,
77-
* VersionNumber?: string,
77+
* VersionNumber?: int,
7878
* StatementId?: string,
7979
* Action?: string,
8080
* Principal?: string,
@@ -98,7 +98,7 @@ public function __construct(array $input = [])
9898
/**
9999
* @param array{
100100
* LayerName?: string,
101-
* VersionNumber?: string,
101+
* VersionNumber?: int,
102102
* StatementId?: string,
103103
* Action?: string,
104104
* Principal?: string,
@@ -142,7 +142,7 @@ public function getStatementId(): ?string
142142
return $this->statementId;
143143
}
144144

145-
public function getVersionNumber(): ?string
145+
public function getVersionNumber(): ?int
146146
{
147147
return $this->versionNumber;
148148
}
@@ -170,7 +170,7 @@ public function request(): Request
170170
if (null === $v = $this->versionNumber) {
171171
throw new InvalidArgument(sprintf('Missing parameter "VersionNumber" for "%s". The value cannot be null.', __CLASS__));
172172
}
173-
$uri['VersionNumber'] = $v;
173+
$uri['VersionNumber'] = (string) $v;
174174
$uriString = '/2018-10-31/layers/' . rawurlencode($uri['LayerName']) . '/versions/' . rawurlencode($uri['VersionNumber']) . '/policy';
175175

176176
// Prepare Body
@@ -223,7 +223,7 @@ public function setStatementId(?string $value): self
223223
return $this;
224224
}
225225

226-
public function setVersionNumber(?string $value): self
226+
public function setVersionNumber(?int $value): self
227227
{
228228
$this->versionNumber = $value;
229229

src/LambdaClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class LambdaClient extends AbstractApi
7878
*
7979
* @param array{
8080
* LayerName: string,
81-
* VersionNumber: string,
81+
* VersionNumber: int,
8282
* StatementId: string,
8383
* Action: string,
8484
* Principal: string,

src/Result/ListFunctionsResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ private function populateResultFunctionConfiguration(array $json): FunctionConfi
198198
'Runtime' => isset($json['Runtime']) ? (string) $json['Runtime'] : null,
199199
'Role' => isset($json['Role']) ? (string) $json['Role'] : null,
200200
'Handler' => isset($json['Handler']) ? (string) $json['Handler'] : null,
201-
'CodeSize' => isset($json['CodeSize']) ? (string) $json['CodeSize'] : null,
201+
'CodeSize' => isset($json['CodeSize']) ? (int) $json['CodeSize'] : null,
202202
'Description' => isset($json['Description']) ? (string) $json['Description'] : null,
203203
'Timeout' => isset($json['Timeout']) ? (int) $json['Timeout'] : null,
204204
'MemorySize' => isset($json['MemorySize']) ? (int) $json['MemorySize'] : null,
@@ -273,7 +273,7 @@ private function populateResultLayer(array $json): Layer
273273
{
274274
return new Layer([
275275
'Arn' => isset($json['Arn']) ? (string) $json['Arn'] : null,
276-
'CodeSize' => isset($json['CodeSize']) ? (string) $json['CodeSize'] : null,
276+
'CodeSize' => isset($json['CodeSize']) ? (int) $json['CodeSize'] : null,
277277
'SigningProfileVersionArn' => isset($json['SigningProfileVersionArn']) ? (string) $json['SigningProfileVersionArn'] : null,
278278
'SigningJobArn' => isset($json['SigningJobArn']) ? (string) $json['SigningJobArn'] : null,
279279
]);

src/Result/ListLayerVersionsResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private function populateResultLayerVersionsListItem(array $json): LayerVersions
144144
{
145145
return new LayerVersionsListItem([
146146
'LayerVersionArn' => isset($json['LayerVersionArn']) ? (string) $json['LayerVersionArn'] : null,
147-
'Version' => isset($json['Version']) ? (string) $json['Version'] : null,
147+
'Version' => isset($json['Version']) ? (int) $json['Version'] : null,
148148
'Description' => isset($json['Description']) ? (string) $json['Description'] : null,
149149
'CreatedDate' => isset($json['CreatedDate']) ? (string) $json['CreatedDate'] : null,
150150
'CompatibleRuntimes' => !isset($json['CompatibleRuntimes']) ? null : $this->populateResultCompatibleRuntimes($json['CompatibleRuntimes']),

src/Result/ListVersionsByFunctionResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ private function populateResultFunctionConfiguration(array $json): FunctionConfi
196196
'Runtime' => isset($json['Runtime']) ? (string) $json['Runtime'] : null,
197197
'Role' => isset($json['Role']) ? (string) $json['Role'] : null,
198198
'Handler' => isset($json['Handler']) ? (string) $json['Handler'] : null,
199-
'CodeSize' => isset($json['CodeSize']) ? (string) $json['CodeSize'] : null,
199+
'CodeSize' => isset($json['CodeSize']) ? (int) $json['CodeSize'] : null,
200200
'Description' => isset($json['Description']) ? (string) $json['Description'] : null,
201201
'Timeout' => isset($json['Timeout']) ? (int) $json['Timeout'] : null,
202202
'MemorySize' => isset($json['MemorySize']) ? (int) $json['MemorySize'] : null,
@@ -271,7 +271,7 @@ private function populateResultLayer(array $json): Layer
271271
{
272272
return new Layer([
273273
'Arn' => isset($json['Arn']) ? (string) $json['Arn'] : null,
274-
'CodeSize' => isset($json['CodeSize']) ? (string) $json['CodeSize'] : null,
274+
'CodeSize' => isset($json['CodeSize']) ? (int) $json['CodeSize'] : null,
275275
'SigningProfileVersionArn' => isset($json['SigningProfileVersionArn']) ? (string) $json['SigningProfileVersionArn'] : null,
276276
'SigningJobArn' => isset($json['SigningJobArn']) ? (string) $json['SigningJobArn'] : null,
277277
]);

src/Result/PublishLayerVersionResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function getLicenseInfo(): ?string
125125
return $this->licenseInfo;
126126
}
127127

128-
public function getVersion(): ?string
128+
public function getVersion(): ?int
129129
{
130130
$this->initialize();
131131

@@ -141,7 +141,7 @@ protected function populateResult(Response $response): void
141141
$this->layerVersionArn = isset($data['LayerVersionArn']) ? (string) $data['LayerVersionArn'] : null;
142142
$this->description = isset($data['Description']) ? (string) $data['Description'] : null;
143143
$this->createdDate = isset($data['CreatedDate']) ? (string) $data['CreatedDate'] : null;
144-
$this->version = isset($data['Version']) ? (string) $data['Version'] : null;
144+
$this->version = isset($data['Version']) ? (int) $data['Version'] : null;
145145
$this->compatibleRuntimes = empty($data['CompatibleRuntimes']) ? [] : $this->populateResultCompatibleRuntimes($data['CompatibleRuntimes']);
146146
$this->licenseInfo = isset($data['LicenseInfo']) ? (string) $data['LicenseInfo'] : null;
147147
$this->compatibleArchitectures = empty($data['CompatibleArchitectures']) ? [] : $this->populateResultCompatibleArchitectures($data['CompatibleArchitectures']);
@@ -184,7 +184,7 @@ private function populateResultLayerVersionContentOutput(array $json): LayerVers
184184
return new LayerVersionContentOutput([
185185
'Location' => isset($json['Location']) ? (string) $json['Location'] : null,
186186
'CodeSha256' => isset($json['CodeSha256']) ? (string) $json['CodeSha256'] : null,
187-
'CodeSize' => isset($json['CodeSize']) ? (string) $json['CodeSize'] : null,
187+
'CodeSize' => isset($json['CodeSize']) ? (int) $json['CodeSize'] : null,
188188
'SigningProfileVersionArn' => isset($json['SigningProfileVersionArn']) ? (string) $json['SigningProfileVersionArn'] : null,
189189
'SigningJobArn' => isset($json['SigningJobArn']) ? (string) $json['SigningJobArn'] : null,
190190
]);

src/ValueObject/FunctionConfiguration.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ final class FunctionConfiguration
222222
* Runtime?: null|Runtime::*,
223223
* Role?: null|string,
224224
* Handler?: null|string,
225-
* CodeSize?: null|string,
225+
* CodeSize?: null|int,
226226
* Description?: null|string,
227227
* Timeout?: null|int,
228228
* MemorySize?: null|int,
@@ -300,7 +300,7 @@ public function __construct(array $input)
300300
* Runtime?: null|Runtime::*,
301301
* Role?: null|string,
302302
* Handler?: null|string,
303-
* CodeSize?: null|string,
303+
* CodeSize?: null|int,
304304
* Description?: null|string,
305305
* Timeout?: null|int,
306306
* MemorySize?: null|int,
@@ -350,7 +350,7 @@ public function getCodeSha256(): ?string
350350
return $this->codeSha256;
351351
}
352352

353-
public function getCodeSize(): ?string
353+
public function getCodeSize(): ?int
354354
{
355355
return $this->codeSize;
356356
}

src/ValueObject/Layer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ final class Layer
3232
/**
3333
* @param array{
3434
* Arn?: null|string,
35-
* CodeSize?: null|string,
35+
* CodeSize?: null|int,
3636
* SigningProfileVersionArn?: null|string,
3737
* SigningJobArn?: null|string,
3838
* } $input
@@ -48,7 +48,7 @@ public function __construct(array $input)
4848
/**
4949
* @param array{
5050
* Arn?: null|string,
51-
* CodeSize?: null|string,
51+
* CodeSize?: null|int,
5252
* SigningProfileVersionArn?: null|string,
5353
* SigningJobArn?: null|string,
5454
* }|Layer $input
@@ -63,7 +63,7 @@ public function getArn(): ?string
6363
return $this->arn;
6464
}
6565

66-
public function getCodeSize(): ?string
66+
public function getCodeSize(): ?int
6767
{
6868
return $this->codeSize;
6969
}

src/ValueObject/LayerVersionContentOutput.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ final class LayerVersionContentOutput
3838
* @param array{
3939
* Location?: null|string,
4040
* CodeSha256?: null|string,
41-
* CodeSize?: null|string,
41+
* CodeSize?: null|int,
4242
* SigningProfileVersionArn?: null|string,
4343
* SigningJobArn?: null|string,
4444
* } $input
@@ -56,7 +56,7 @@ public function __construct(array $input)
5656
* @param array{
5757
* Location?: null|string,
5858
* CodeSha256?: null|string,
59-
* CodeSize?: null|string,
59+
* CodeSize?: null|int,
6060
* SigningProfileVersionArn?: null|string,
6161
* SigningJobArn?: null|string,
6262
* }|LayerVersionContentOutput $input
@@ -71,7 +71,7 @@ public function getCodeSha256(): ?string
7171
return $this->codeSha256;
7272
}
7373

74-
public function getCodeSize(): ?string
74+
public function getCodeSize(): ?int
7575
{
7676
return $this->codeSize;
7777
}

0 commit comments

Comments
 (0)