Skip to content

Commit 58f37e9

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 29b3644 commit 58f37e9

File tree

6 files changed

+17
-12
lines changed

6 files changed

+17
-12
lines changed

CHANGELOG.md

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

33
## NOT RELEASED
44

5+
### BC-BREAK
6+
7+
- The return type for `\AsyncAws\CodeBuild\ValueObject\Build::getBuildNumber` uses `int` instead of `string` to reflect the AWS type.
8+
- The return type for `\AsyncAws\CodeBuild\ValueObject\BuildPhase::getDurationInSeconds` uses `int` instead of `string` to reflect the AWS type.
9+
510
## 1.0.0
611

712
### Added

src/Result/BatchGetBuildsOutput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ private function populateResultBuild(array $json): Build
7272
return new Build([
7373
'id' => isset($json['id']) ? (string) $json['id'] : null,
7474
'arn' => isset($json['arn']) ? (string) $json['arn'] : null,
75-
'buildNumber' => isset($json['buildNumber']) ? (string) $json['buildNumber'] : null,
75+
'buildNumber' => isset($json['buildNumber']) ? (int) $json['buildNumber'] : null,
7676
'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['startTime'])))) ? $d : null,
7777
'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['endTime'])))) ? $d : null,
7878
'currentPhase' => isset($json['currentPhase']) ? (string) $json['currentPhase'] : null,
@@ -154,7 +154,7 @@ private function populateResultBuildPhase(array $json): BuildPhase
154154
'phaseStatus' => isset($json['phaseStatus']) ? (string) $json['phaseStatus'] : null,
155155
'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['startTime'])))) ? $d : null,
156156
'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['endTime'])))) ? $d : null,
157-
'durationInSeconds' => isset($json['durationInSeconds']) ? (string) $json['durationInSeconds'] : null,
157+
'durationInSeconds' => isset($json['durationInSeconds']) ? (int) $json['durationInSeconds'] : null,
158158
'contexts' => !isset($json['contexts']) ? null : $this->populateResultPhaseContexts($json['contexts']),
159159
]);
160160
}

src/Result/StartBuildOutput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private function populateResultBuild(array $json): Build
5353
return new Build([
5454
'id' => isset($json['id']) ? (string) $json['id'] : null,
5555
'arn' => isset($json['arn']) ? (string) $json['arn'] : null,
56-
'buildNumber' => isset($json['buildNumber']) ? (string) $json['buildNumber'] : null,
56+
'buildNumber' => isset($json['buildNumber']) ? (int) $json['buildNumber'] : null,
5757
'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['startTime'])))) ? $d : null,
5858
'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['endTime'])))) ? $d : null,
5959
'currentPhase' => isset($json['currentPhase']) ? (string) $json['currentPhase'] : null,
@@ -119,7 +119,7 @@ private function populateResultBuildPhase(array $json): BuildPhase
119119
'phaseStatus' => isset($json['phaseStatus']) ? (string) $json['phaseStatus'] : null,
120120
'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['startTime'])))) ? $d : null,
121121
'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['endTime'])))) ? $d : null,
122-
'durationInSeconds' => isset($json['durationInSeconds']) ? (string) $json['durationInSeconds'] : null,
122+
'durationInSeconds' => isset($json['durationInSeconds']) ? (int) $json['durationInSeconds'] : null,
123123
'contexts' => !isset($json['contexts']) ? null : $this->populateResultPhaseContexts($json['contexts']),
124124
]);
125125
}

src/Result/StopBuildOutput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private function populateResultBuild(array $json): Build
5353
return new Build([
5454
'id' => isset($json['id']) ? (string) $json['id'] : null,
5555
'arn' => isset($json['arn']) ? (string) $json['arn'] : null,
56-
'buildNumber' => isset($json['buildNumber']) ? (string) $json['buildNumber'] : null,
56+
'buildNumber' => isset($json['buildNumber']) ? (int) $json['buildNumber'] : null,
5757
'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['startTime'])))) ? $d : null,
5858
'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['endTime'])))) ? $d : null,
5959
'currentPhase' => isset($json['currentPhase']) ? (string) $json['currentPhase'] : null,
@@ -119,7 +119,7 @@ private function populateResultBuildPhase(array $json): BuildPhase
119119
'phaseStatus' => isset($json['phaseStatus']) ? (string) $json['phaseStatus'] : null,
120120
'startTime' => (isset($json['startTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['startTime'])))) ? $d : null,
121121
'endTime' => (isset($json['endTime']) && ($d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $json['endTime'])))) ? $d : null,
122-
'durationInSeconds' => isset($json['durationInSeconds']) ? (string) $json['durationInSeconds'] : null,
122+
'durationInSeconds' => isset($json['durationInSeconds']) ? (int) $json['durationInSeconds'] : null,
123123
'contexts' => !isset($json['contexts']) ? null : $this->populateResultPhaseContexts($json['contexts']),
124124
]);
125125
}

src/ValueObject/Build.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ final class Build
221221
* @param array{
222222
* id?: null|string,
223223
* arn?: null|string,
224-
* buildNumber?: null|string,
224+
* buildNumber?: null|int,
225225
* startTime?: null|\DateTimeImmutable,
226226
* endTime?: null|\DateTimeImmutable,
227227
* currentPhase?: null|string,
@@ -293,7 +293,7 @@ public function __construct(array $input)
293293
* @param array{
294294
* id?: null|string,
295295
* arn?: null|string,
296-
* buildNumber?: null|string,
296+
* buildNumber?: null|int,
297297
* startTime?: null|\DateTimeImmutable,
298298
* endTime?: null|\DateTimeImmutable,
299299
* currentPhase?: null|string,
@@ -350,7 +350,7 @@ public function getBuildComplete(): ?bool
350350
return $this->buildComplete;
351351
}
352352

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

src/ValueObject/BuildPhase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ final class BuildPhase
9999
* phaseStatus?: null|StatusType::*,
100100
* startTime?: null|\DateTimeImmutable,
101101
* endTime?: null|\DateTimeImmutable,
102-
* durationInSeconds?: null|string,
102+
* durationInSeconds?: null|int,
103103
* contexts?: null|array<PhaseContext|array>,
104104
* } $input
105105
*/
@@ -119,7 +119,7 @@ public function __construct(array $input)
119119
* phaseStatus?: null|StatusType::*,
120120
* startTime?: null|\DateTimeImmutable,
121121
* endTime?: null|\DateTimeImmutable,
122-
* durationInSeconds?: null|string,
122+
* durationInSeconds?: null|int,
123123
* contexts?: null|array<PhaseContext|array>,
124124
* }|BuildPhase $input
125125
*/
@@ -136,7 +136,7 @@ public function getContexts(): array
136136
return $this->contexts ?? [];
137137
}
138138

139-
public function getDurationInSeconds(): ?string
139+
public function getDurationInSeconds(): ?int
140140
{
141141
return $this->durationInSeconds;
142142
}

0 commit comments

Comments
 (0)