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
*/

0 commit comments

Comments
 (0)