Skip to content

Commit 26b5d05

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 4e16450 commit 26b5d05

File tree

6 files changed

+24
-18
lines changed

6 files changed

+24
-18
lines changed

CHANGELOG.md

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

33
## NOT RELEASED
44

5+
### BC-BREAK
6+
7+
- The type for `\AsyncAws\Iot\Input\DeleteThingGroupRequest::getExpectedVersion` and `\AsyncAws\Iot\Input\DeleteThingGroupRequest::setExpectedVersion` uses `int` instead of `string` to reflect the AWS type.
8+
- The type for `\AsyncAws\Iot\Input\DeleteThingRequest::getExpectedVersion` and `\AsyncAws\Iot\Input\DeleteThingGroupRequest::setExpectedVersion` uses `int` instead of `string` to reflect the AWS type.
9+
- The return type for `\AsyncAws\Iot\ValueObject\ThingAttribute::getVersion` uses `int` instead of `string` to reflect the AWS type.
10+
511
## 1.0.0
612

713
### Added

src/Input/DeleteThingGroupRequest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ final class DeleteThingGroupRequest extends Input
2121
/**
2222
* The expected version of the thing group to delete.
2323
*
24-
* @var string|null
24+
* @var int|null
2525
*/
2626
private $expectedVersion;
2727

2828
/**
2929
* @param array{
3030
* thingGroupName?: string,
31-
* expectedVersion?: string,
31+
* expectedVersion?: int,
3232
* '@region'?: string|null,
3333
* } $input
3434
*/
@@ -42,7 +42,7 @@ public function __construct(array $input = [])
4242
/**
4343
* @param array{
4444
* thingGroupName?: string,
45-
* expectedVersion?: string,
45+
* expectedVersion?: int,
4646
* '@region'?: string|null,
4747
* }|DeleteThingGroupRequest $input
4848
*/
@@ -51,7 +51,7 @@ public static function create($input): self
5151
return $input instanceof self ? $input : new self($input);
5252
}
5353

54-
public function getExpectedVersion(): ?string
54+
public function getExpectedVersion(): ?int
5555
{
5656
return $this->expectedVersion;
5757
}
@@ -72,7 +72,7 @@ public function request(): Request
7272
// Prepare query
7373
$query = [];
7474
if (null !== $this->expectedVersion) {
75-
$query['expectedVersion'] = $this->expectedVersion;
75+
$query['expectedVersion'] = (string) $this->expectedVersion;
7676
}
7777

7878
// Prepare URI
@@ -90,7 +90,7 @@ public function request(): Request
9090
return new Request('DELETE', $uriString, $query, $headers, StreamFactory::create($body));
9191
}
9292

93-
public function setExpectedVersion(?string $value): self
93+
public function setExpectedVersion(?int $value): self
9494
{
9595
$this->expectedVersion = $value;
9696

src/Input/DeleteThingRequest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ final class DeleteThingRequest extends Input
2626
* the expected version specified in the request, the `DeleteThing` request is rejected with a
2727
* `VersionConflictException`.
2828
*
29-
* @var string|null
29+
* @var int|null
3030
*/
3131
private $expectedVersion;
3232

3333
/**
3434
* @param array{
3535
* thingName?: string,
36-
* expectedVersion?: string,
36+
* expectedVersion?: int,
3737
* '@region'?: string|null,
3838
* } $input
3939
*/
@@ -47,7 +47,7 @@ public function __construct(array $input = [])
4747
/**
4848
* @param array{
4949
* thingName?: string,
50-
* expectedVersion?: string,
50+
* expectedVersion?: int,
5151
* '@region'?: string|null,
5252
* }|DeleteThingRequest $input
5353
*/
@@ -56,7 +56,7 @@ public static function create($input): self
5656
return $input instanceof self ? $input : new self($input);
5757
}
5858

59-
public function getExpectedVersion(): ?string
59+
public function getExpectedVersion(): ?int
6060
{
6161
return $this->expectedVersion;
6262
}
@@ -77,7 +77,7 @@ public function request(): Request
7777
// Prepare query
7878
$query = [];
7979
if (null !== $this->expectedVersion) {
80-
$query['expectedVersion'] = $this->expectedVersion;
80+
$query['expectedVersion'] = (string) $this->expectedVersion;
8181
}
8282

8383
// Prepare URI
@@ -95,7 +95,7 @@ public function request(): Request
9595
return new Request('DELETE', $uriString, $query, $headers, StreamFactory::create($body));
9696
}
9797

98-
public function setExpectedVersion(?string $value): self
98+
public function setExpectedVersion(?int $value): self
9999
{
100100
$this->expectedVersion = $value;
101101

src/IotClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public function createThingType($input): CreateThingTypeResponse
221221
*
222222
* @param array{
223223
* thingName: string,
224-
* expectedVersion?: string,
224+
* expectedVersion?: int,
225225
* '@region'?: string|null,
226226
* }|DeleteThingRequest $input
227227
*
@@ -261,7 +261,7 @@ public function deleteThing($input): DeleteThingResponse
261261
*
262262
* @param array{
263263
* thingGroupName: string,
264-
* expectedVersion?: string,
264+
* expectedVersion?: int,
265265
* '@region'?: string|null,
266266
* }|DeleteThingGroupRequest $input
267267
*

src/Result/ListThingsResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private function populateResultThingAttribute(array $json): ThingAttribute
115115
'thingTypeName' => isset($json['thingTypeName']) ? (string) $json['thingTypeName'] : null,
116116
'thingArn' => isset($json['thingArn']) ? (string) $json['thingArn'] : null,
117117
'attributes' => !isset($json['attributes']) ? null : $this->populateResultAttributes($json['attributes']),
118-
'version' => isset($json['version']) ? (string) $json['version'] : null,
118+
'version' => isset($json['version']) ? (int) $json['version'] : null,
119119
]);
120120
}
121121

src/ValueObject/ThingAttribute.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ final class ThingAttribute
3838
* thingTypeName?: null|string,
3939
* thingArn?: null|string,
4040
* attributes?: null|array<string, string>,
41-
* version?: null|string,
41+
* version?: null|int,
4242
* } $input
4343
*/
4444
public function __construct(array $input)
@@ -56,7 +56,7 @@ public function __construct(array $input)
5656
* thingTypeName?: null|string,
5757
* thingArn?: null|string,
5858
* attributes?: null|array<string, string>,
59-
* version?: null|string,
59+
* version?: null|int,
6060
* }|ThingAttribute $input
6161
*/
6262
public static function create($input): self
@@ -87,7 +87,7 @@ public function getThingTypeName(): ?string
8787
return $this->thingTypeName;
8888
}
8989

90-
public function getVersion(): ?string
90+
public function getVersion(): ?int
9191
{
9292
return $this->version;
9393
}

0 commit comments

Comments
 (0)