Skip to content

Commit 4f37376

Browse files
authored
Allow passing explicit null values for optional input members (#1542)
This makes it easier to define the array literal for input objects as PHP does not have a syntax sugar for conditional keys in an array literal. This is consistent with the generated code for value objects. Even though input objects allow to omit required members in the constructor shape (as they can be set later by using the setter), the phpdoc type still does not allow passing null explicitly (even though the code would deal with it until the validation run) so that static analysis tools can catch mistakes there. Passing a required member explicitly is intended to pass a valid value for it and not a potentially missing one.
1 parent e7954b3 commit 4f37376

File tree

5 files changed

+36
-36
lines changed

5 files changed

+36
-36
lines changed

src/CodeCommitClient.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ class CodeCommitClient extends AbstractApi
8484
*
8585
* @param array{
8686
* repositoryName: string,
87-
* repositoryDescription?: string,
88-
* tags?: array<string, string>,
87+
* repositoryDescription?: null|string,
88+
* tags?: null|array<string, string>,
8989
* '@region'?: string|null,
9090
* }|CreateRepositoryInput $input
9191
*
@@ -218,8 +218,8 @@ public function getBlob($input): GetBlobOutput
218218
* @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-codecommit-2015-04-13.html#getbranch
219219
*
220220
* @param array{
221-
* repositoryName?: string,
222-
* branchName?: string,
221+
* repositoryName?: null|string,
222+
* branchName?: null|string,
223223
* '@region'?: string|null,
224224
* }|GetBranchInput $input
225225
*
@@ -308,12 +308,12 @@ public function getCommit($input): GetCommitOutput
308308
*
309309
* @param array{
310310
* repositoryName: string,
311-
* beforeCommitSpecifier?: string,
311+
* beforeCommitSpecifier?: null|string,
312312
* afterCommitSpecifier: string,
313-
* beforePath?: string,
314-
* afterPath?: string,
315-
* MaxResults?: int,
316-
* NextToken?: string,
313+
* beforePath?: null|string,
314+
* afterPath?: null|string,
315+
* MaxResults?: null|int,
316+
* NextToken?: null|string,
317317
* '@region'?: string|null,
318318
* }|GetDifferencesInput $input
319319
*
@@ -366,9 +366,9 @@ public function getDifferences($input): GetDifferencesOutput
366366
* @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-codecommit-2015-04-13.html#listrepositories
367367
*
368368
* @param array{
369-
* nextToken?: string,
370-
* sortBy?: SortByEnum::*,
371-
* order?: OrderEnum::*,
369+
* nextToken?: null|string,
370+
* sortBy?: null|SortByEnum::*,
371+
* order?: null|OrderEnum::*,
372372
* '@region'?: string|null,
373373
* }|ListRepositoriesInput $input
374374
*

src/Input/CreateRepositoryInput.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ final class CreateRepositoryInput extends Input
4949
/**
5050
* @param array{
5151
* repositoryName?: string,
52-
* repositoryDescription?: string,
53-
* tags?: array<string, string>,
52+
* repositoryDescription?: null|string,
53+
* tags?: null|array<string, string>,
5454
* '@region'?: string|null,
5555
* } $input
5656
*/
@@ -65,8 +65,8 @@ public function __construct(array $input = [])
6565
/**
6666
* @param array{
6767
* repositoryName?: string,
68-
* repositoryDescription?: string,
69-
* tags?: array<string, string>,
68+
* repositoryDescription?: null|string,
69+
* tags?: null|array<string, string>,
7070
* '@region'?: string|null,
7171
* }|CreateRepositoryInput $input
7272
*/

src/Input/GetBranchInput.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ final class GetBranchInput extends Input
2727

2828
/**
2929
* @param array{
30-
* repositoryName?: string,
31-
* branchName?: string,
30+
* repositoryName?: null|string,
31+
* branchName?: null|string,
3232
* '@region'?: string|null,
3333
* } $input
3434
*/
@@ -41,8 +41,8 @@ public function __construct(array $input = [])
4141

4242
/**
4343
* @param array{
44-
* repositoryName?: string,
45-
* branchName?: string,
44+
* repositoryName?: null|string,
45+
* branchName?: null|string,
4646
* '@region'?: string|null,
4747
* }|GetBranchInput $input
4848
*/

src/Input/GetDifferencesInput.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ final class GetDifferencesInput extends Input
7070
/**
7171
* @param array{
7272
* repositoryName?: string,
73-
* beforeCommitSpecifier?: string,
73+
* beforeCommitSpecifier?: null|string,
7474
* afterCommitSpecifier?: string,
75-
* beforePath?: string,
76-
* afterPath?: string,
77-
* MaxResults?: int,
78-
* NextToken?: string,
75+
* beforePath?: null|string,
76+
* afterPath?: null|string,
77+
* MaxResults?: null|int,
78+
* NextToken?: null|string,
7979
* '@region'?: string|null,
8080
* } $input
8181
*/
@@ -94,12 +94,12 @@ public function __construct(array $input = [])
9494
/**
9595
* @param array{
9696
* repositoryName?: string,
97-
* beforeCommitSpecifier?: string,
97+
* beforeCommitSpecifier?: null|string,
9898
* afterCommitSpecifier?: string,
99-
* beforePath?: string,
100-
* afterPath?: string,
101-
* MaxResults?: int,
102-
* NextToken?: string,
99+
* beforePath?: null|string,
100+
* afterPath?: null|string,
101+
* MaxResults?: null|int,
102+
* NextToken?: null|string,
103103
* '@region'?: string|null,
104104
* }|GetDifferencesInput $input
105105
*/

src/Input/ListRepositoriesInput.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ final class ListRepositoriesInput extends Input
3939

4040
/**
4141
* @param array{
42-
* nextToken?: string,
43-
* sortBy?: SortByEnum::*,
44-
* order?: OrderEnum::*,
42+
* nextToken?: null|string,
43+
* sortBy?: null|SortByEnum::*,
44+
* order?: null|OrderEnum::*,
4545
* '@region'?: string|null,
4646
* } $input
4747
*/
@@ -55,9 +55,9 @@ public function __construct(array $input = [])
5555

5656
/**
5757
* @param array{
58-
* nextToken?: string,
59-
* sortBy?: SortByEnum::*,
60-
* order?: OrderEnum::*,
58+
* nextToken?: null|string,
59+
* sortBy?: null|SortByEnum::*,
60+
* order?: null|OrderEnum::*,
6161
* '@region'?: string|null,
6262
* }|ListRepositoriesInput $input
6363
*/

0 commit comments

Comments
 (0)