Skip to content

Commit 77ebc34

Browse files
authored
Fix the generated param types for maps and lists (#1466)
The constructor are not enforcing the usage of value objects. They also support passing an array accepted by the create method.
1 parent 22c9b08 commit 77ebc34

File tree

178 files changed

+551
-551
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+551
-551
lines changed

src/CodeGenerator/src/Generator/CodeGenerator/TypeGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ public function generateDocblock(StructureShape $shape, ClassName $shapeClassNam
6161
// is the list item an object?
6262
if ($listMemberShape instanceof StructureShape) {
6363
$classNames[] = $className = $this->namespaceRegistry->getObject($listMemberShape);
64-
$param = $className->getName() . '[]';
64+
$param = 'array<' . $className->getName() . '|array>';
6565
} elseif (!empty($listMemberShape->getEnum())) {
6666
$classNames[] = $className = $this->namespaceRegistry->getEnum($listMemberShape);
67-
$param = 'list<' . $className->getName() . '::*>';
67+
$param = 'array<' . $className->getName() . '::*>';
6868
} else {
6969
$param = $this->getNativePhpType($listMemberShape->getType()) . '[]';
7070
}
@@ -74,7 +74,7 @@ public function generateDocblock(StructureShape $shape, ClassName $shapeClassNam
7474
// is the map item an object?
7575
if ($mapValueShape instanceof StructureShape) {
7676
$classNames[] = $className = $this->namespaceRegistry->getObject($mapValueShape);
77-
$param = $className->getName();
77+
$param = $className->getName() . '|array';
7878
} elseif (!empty($mapValueShape->getEnum())) {
7979
$classNames[] = $className = $this->namespaceRegistry->getEnum($mapValueShape);
8080
$param = $className->getName() . '::*';

src/Core/src/Sts/Input/AssumeRoleRequest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,10 @@ final class AssumeRoleRequest extends Input
232232
* @param array{
233233
* RoleArn?: string,
234234
* RoleSessionName?: string,
235-
* PolicyArns?: PolicyDescriptorType[],
235+
* PolicyArns?: array<PolicyDescriptorType|array>,
236236
* Policy?: string,
237237
* DurationSeconds?: int,
238-
* Tags?: Tag[],
238+
* Tags?: array<Tag|array>,
239239
* TransitiveTagKeys?: string[],
240240
* ExternalId?: string,
241241
* SerialNumber?: string,
@@ -264,10 +264,10 @@ public function __construct(array $input = [])
264264
* @param array{
265265
* RoleArn?: string,
266266
* RoleSessionName?: string,
267-
* PolicyArns?: PolicyDescriptorType[],
267+
* PolicyArns?: array<PolicyDescriptorType|array>,
268268
* Policy?: string,
269269
* DurationSeconds?: int,
270-
* Tags?: Tag[],
270+
* Tags?: array<Tag|array>,
271271
* TransitiveTagKeys?: string[],
272272
* ExternalId?: string,
273273
* SerialNumber?: string,

src/Core/src/Sts/Input/AssumeRoleWithWebIdentityRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ final class AssumeRoleWithWebIdentityRequest extends Input
135135
* RoleSessionName?: string,
136136
* WebIdentityToken?: string,
137137
* ProviderId?: string,
138-
* PolicyArns?: PolicyDescriptorType[],
138+
* PolicyArns?: array<PolicyDescriptorType|array>,
139139
* Policy?: string,
140140
* DurationSeconds?: int,
141141
* '@region'?: string|null,
@@ -159,7 +159,7 @@ public function __construct(array $input = [])
159159
* RoleSessionName?: string,
160160
* WebIdentityToken?: string,
161161
* ProviderId?: string,
162-
* PolicyArns?: PolicyDescriptorType[],
162+
* PolicyArns?: array<PolicyDescriptorType|array>,
163163
* Policy?: string,
164164
* DurationSeconds?: int,
165165
* '@region'?: string|null,

src/Core/src/Sts/StsClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ class StsClient extends AbstractApi
112112
* @param array{
113113
* RoleArn: string,
114114
* RoleSessionName: string,
115-
* PolicyArns?: PolicyDescriptorType[],
115+
* PolicyArns?: array<PolicyDescriptorType|array>,
116116
* Policy?: string,
117117
* DurationSeconds?: int,
118-
* Tags?: Tag[],
118+
* Tags?: array<Tag|array>,
119119
* TransitiveTagKeys?: string[],
120120
* ExternalId?: string,
121121
* SerialNumber?: string,
@@ -273,7 +273,7 @@ public function assumeRole($input): AssumeRoleResponse
273273
* RoleSessionName: string,
274274
* WebIdentityToken: string,
275275
* ProviderId?: string,
276-
* PolicyArns?: PolicyDescriptorType[],
276+
* PolicyArns?: array<PolicyDescriptorType|array>,
277277
* Policy?: string,
278278
* DurationSeconds?: int,
279279
* '@region'?: string|null,

src/Service/AppSync/src/ValueObject/BadRequestDetail.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ final class BadRequestDetail
1515

1616
/**
1717
* @param array{
18-
* codeErrors?: null|CodeError[],
18+
* codeErrors?: null|array<CodeError|array>,
1919
* } $input
2020
*/
2121
public function __construct(array $input)
@@ -25,7 +25,7 @@ public function __construct(array $input)
2525

2626
/**
2727
* @param array{
28-
* codeErrors?: null|CodeError[],
28+
* codeErrors?: null|array<CodeError|array>,
2929
* }|BadRequestDetail $input
3030
*/
3131
public static function create($input): self

src/Service/Athena/src/ValueObject/ResultSet.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ final class ResultSet
2020

2121
/**
2222
* @param array{
23-
* Rows?: null|Row[],
23+
* Rows?: null|array<Row|array>,
2424
* ResultSetMetadata?: null|ResultSetMetadata|array,
2525
* } $input
2626
*/
@@ -32,7 +32,7 @@ public function __construct(array $input)
3232

3333
/**
3434
* @param array{
35-
* Rows?: null|Row[],
35+
* Rows?: null|array<Row|array>,
3636
* ResultSetMetadata?: null|ResultSetMetadata|array,
3737
* }|ResultSet $input
3838
*/

src/Service/Athena/src/ValueObject/ResultSetMetadata.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ final class ResultSetMetadata
1515

1616
/**
1717
* @param array{
18-
* ColumnInfo?: null|ColumnInfo[],
18+
* ColumnInfo?: null|array<ColumnInfo|array>,
1919
* } $input
2020
*/
2121
public function __construct(array $input)
@@ -25,7 +25,7 @@ public function __construct(array $input)
2525

2626
/**
2727
* @param array{
28-
* ColumnInfo?: null|ColumnInfo[],
28+
* ColumnInfo?: null|array<ColumnInfo|array>,
2929
* }|ResultSetMetadata $input
3030
*/
3131
public static function create($input): self

src/Service/Athena/src/ValueObject/Row.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class Row
1414

1515
/**
1616
* @param array{
17-
* Data?: null|Datum[],
17+
* Data?: null|array<Datum|array>,
1818
* } $input
1919
*/
2020
public function __construct(array $input)
@@ -24,7 +24,7 @@ public function __construct(array $input)
2424

2525
/**
2626
* @param array{
27-
* Data?: null|Datum[],
27+
* Data?: null|array<Datum|array>,
2828
* }|Row $input
2929
*/
3030
public static function create($input): self

src/Service/Athena/src/ValueObject/TableMetadata.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ final class TableMetadata
4848
* CreateTime?: null|\DateTimeImmutable,
4949
* LastAccessTime?: null|\DateTimeImmutable,
5050
* TableType?: null|string,
51-
* Columns?: null|Column[],
52-
* PartitionKeys?: null|Column[],
51+
* Columns?: null|array<Column|array>,
52+
* PartitionKeys?: null|array<Column|array>,
5353
* Parameters?: null|array<string, string>,
5454
* } $input
5555
*/
@@ -70,8 +70,8 @@ public function __construct(array $input)
7070
* CreateTime?: null|\DateTimeImmutable,
7171
* LastAccessTime?: null|\DateTimeImmutable,
7272
* TableType?: null|string,
73-
* Columns?: null|Column[],
74-
* PartitionKeys?: null|Column[],
73+
* Columns?: null|array<Column|array>,
74+
* PartitionKeys?: null|array<Column|array>,
7575
* Parameters?: null|array<string, string>,
7676
* }|TableMetadata $input
7777
*/

src/Service/CloudFormation/src/ValueObject/RollbackConfiguration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ final class RollbackConfiguration
5252

5353
/**
5454
* @param array{
55-
* RollbackTriggers?: null|RollbackTrigger[],
55+
* RollbackTriggers?: null|array<RollbackTrigger|array>,
5656
* MonitoringTimeInMinutes?: null|int,
5757
* } $input
5858
*/
@@ -64,7 +64,7 @@ public function __construct(array $input)
6464

6565
/**
6666
* @param array{
67-
* RollbackTriggers?: null|RollbackTrigger[],
67+
* RollbackTriggers?: null|array<RollbackTrigger|array>,
6868
* MonitoringTimeInMinutes?: null|int,
6969
* }|RollbackConfiguration $input
7070
*/

src/Service/CloudFormation/src/ValueObject/Stack.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ final class Stack
151151
* StackName: string,
152152
* ChangeSetId?: null|string,
153153
* Description?: null|string,
154-
* Parameters?: null|Parameter[],
154+
* Parameters?: null|array<Parameter|array>,
155155
* CreationTime: \DateTimeImmutable,
156156
* DeletionTime?: null|\DateTimeImmutable,
157157
* LastUpdatedTime?: null|\DateTimeImmutable,
@@ -161,10 +161,10 @@ final class Stack
161161
* DisableRollback?: null|bool,
162162
* NotificationARNs?: null|string[],
163163
* TimeoutInMinutes?: null|int,
164-
* Capabilities?: null|list<Capability::*>,
165-
* Outputs?: null|Output[],
164+
* Capabilities?: null|array<Capability::*>,
165+
* Outputs?: null|array<Output|array>,
166166
* RoleARN?: null|string,
167-
* Tags?: null|Tag[],
167+
* Tags?: null|array<Tag|array>,
168168
* EnableTerminationProtection?: null|bool,
169169
* ParentId?: null|string,
170170
* RootId?: null|string,
@@ -203,7 +203,7 @@ public function __construct(array $input)
203203
* StackName: string,
204204
* ChangeSetId?: null|string,
205205
* Description?: null|string,
206-
* Parameters?: null|Parameter[],
206+
* Parameters?: null|array<Parameter|array>,
207207
* CreationTime: \DateTimeImmutable,
208208
* DeletionTime?: null|\DateTimeImmutable,
209209
* LastUpdatedTime?: null|\DateTimeImmutable,
@@ -213,10 +213,10 @@ public function __construct(array $input)
213213
* DisableRollback?: null|bool,
214214
* NotificationARNs?: null|string[],
215215
* TimeoutInMinutes?: null|int,
216-
* Capabilities?: null|list<Capability::*>,
217-
* Outputs?: null|Output[],
216+
* Capabilities?: null|array<Capability::*>,
217+
* Outputs?: null|array<Output|array>,
218218
* RoleARN?: null|string,
219-
* Tags?: null|Tag[],
219+
* Tags?: null|array<Tag|array>,
220220
* EnableTerminationProtection?: null|bool,
221221
* ParentId?: null|string,
222222
* RootId?: null|string,

src/Service/CloudWatch/src/CloudWatchClient.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class CloudWatchClient extends AbstractApi
8585
* @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-monitoring-2010-08-01.html#getmetricdata
8686
*
8787
* @param array{
88-
* MetricDataQueries: MetricDataQuery[],
88+
* MetricDataQueries: array<MetricDataQuery|array>,
8989
* StartTime: \DateTimeImmutable|string,
9090
* EndTime: \DateTimeImmutable|string,
9191
* NextToken?: string,
@@ -154,11 +154,11 @@ public function getMetricData($input): GetMetricDataOutput
154154
* @param array{
155155
* Namespace: string,
156156
* MetricName: string,
157-
* Dimensions?: Dimension[],
157+
* Dimensions?: array<Dimension|array>,
158158
* StartTime: \DateTimeImmutable|string,
159159
* EndTime: \DateTimeImmutable|string,
160160
* Period: int,
161-
* Statistics?: list<Statistic::*>,
161+
* Statistics?: array<Statistic::*>,
162162
* ExtendedStatistics?: string[],
163163
* Unit?: StandardUnit::*,
164164
* '@region'?: string|null,
@@ -212,7 +212,7 @@ public function getMetricStatistics($input): GetMetricStatisticsOutput
212212
* @param array{
213213
* Namespace?: string,
214214
* MetricName?: string,
215-
* Dimensions?: DimensionFilter[],
215+
* Dimensions?: array<DimensionFilter|array>,
216216
* NextToken?: string,
217217
* RecentlyActive?: RecentlyActive::*,
218218
* IncludeLinkedAccounts?: bool,
@@ -281,7 +281,7 @@ public function listMetrics($input = []): ListMetricsOutput
281281
*
282282
* @param array{
283283
* Namespace: string,
284-
* MetricData: MetricDatum[],
284+
* MetricData: array<MetricDatum|array>,
285285
* '@region'?: string|null,
286286
* }|PutMetricDataInput $input
287287
*

src/Service/CloudWatch/src/Input/GetMetricDataInput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ final class GetMetricDataInput extends Input
104104

105105
/**
106106
* @param array{
107-
* MetricDataQueries?: MetricDataQuery[],
107+
* MetricDataQueries?: array<MetricDataQuery|array>,
108108
* StartTime?: \DateTimeImmutable|string,
109109
* EndTime?: \DateTimeImmutable|string,
110110
* NextToken?: string,
@@ -128,7 +128,7 @@ public function __construct(array $input = [])
128128

129129
/**
130130
* @param array{
131-
* MetricDataQueries?: MetricDataQuery[],
131+
* MetricDataQueries?: array<MetricDataQuery|array>,
132132
* StartTime?: \DateTimeImmutable|string,
133133
* EndTime?: \DateTimeImmutable|string,
134134
* NextToken?: string,

src/Service/CloudWatch/src/Input/GetMetricStatisticsInput.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ final class GetMetricStatisticsInput extends Input
134134
* @param array{
135135
* Namespace?: string,
136136
* MetricName?: string,
137-
* Dimensions?: Dimension[],
137+
* Dimensions?: array<Dimension|array>,
138138
* StartTime?: \DateTimeImmutable|string,
139139
* EndTime?: \DateTimeImmutable|string,
140140
* Period?: int,
141-
* Statistics?: list<Statistic::*>,
141+
* Statistics?: array<Statistic::*>,
142142
* ExtendedStatistics?: string[],
143143
* Unit?: StandardUnit::*,
144144
* '@region'?: string|null,
@@ -162,11 +162,11 @@ public function __construct(array $input = [])
162162
* @param array{
163163
* Namespace?: string,
164164
* MetricName?: string,
165-
* Dimensions?: Dimension[],
165+
* Dimensions?: array<Dimension|array>,
166166
* StartTime?: \DateTimeImmutable|string,
167167
* EndTime?: \DateTimeImmutable|string,
168168
* Period?: int,
169-
* Statistics?: list<Statistic::*>,
169+
* Statistics?: array<Statistic::*>,
170170
* ExtendedStatistics?: string[],
171171
* Unit?: StandardUnit::*,
172172
* '@region'?: string|null,

src/Service/CloudWatch/src/Input/ListMetricsInput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ final class ListMetricsInput extends Input
7373
* @param array{
7474
* Namespace?: string,
7575
* MetricName?: string,
76-
* Dimensions?: DimensionFilter[],
76+
* Dimensions?: array<DimensionFilter|array>,
7777
* NextToken?: string,
7878
* RecentlyActive?: RecentlyActive::*,
7979
* IncludeLinkedAccounts?: bool,
@@ -97,7 +97,7 @@ public function __construct(array $input = [])
9797
* @param array{
9898
* Namespace?: string,
9999
* MetricName?: string,
100-
* Dimensions?: DimensionFilter[],
100+
* Dimensions?: array<DimensionFilter|array>,
101101
* NextToken?: string,
102102
* RecentlyActive?: RecentlyActive::*,
103103
* IncludeLinkedAccounts?: bool,

src/Service/CloudWatch/src/Input/PutMetricDataInput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ final class PutMetricDataInput extends Input
3535
/**
3636
* @param array{
3737
* Namespace?: string,
38-
* MetricData?: MetricDatum[],
38+
* MetricData?: array<MetricDatum|array>,
3939
* '@region'?: string|null,
4040
* } $input
4141
*/
@@ -49,7 +49,7 @@ public function __construct(array $input = [])
4949
/**
5050
* @param array{
5151
* Namespace?: string,
52-
* MetricData?: MetricDatum[],
52+
* MetricData?: array<MetricDatum|array>,
5353
* '@region'?: string|null,
5454
* }|PutMetricDataInput $input
5555
*/

src/Service/CloudWatch/src/ValueObject/Metric.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class Metric
2626
* @param array{
2727
* Namespace?: null|string,
2828
* MetricName?: null|string,
29-
* Dimensions?: null|Dimension[],
29+
* Dimensions?: null|array<Dimension|array>,
3030
* } $input
3131
*/
3232
public function __construct(array $input)
@@ -40,7 +40,7 @@ public function __construct(array $input)
4040
* @param array{
4141
* Namespace?: null|string,
4242
* MetricName?: null|string,
43-
* Dimensions?: null|Dimension[],
43+
* Dimensions?: null|array<Dimension|array>,
4444
* }|Metric $input
4545
*/
4646
public static function create($input): self

0 commit comments

Comments
 (0)