Skip to content

Commit 7c7ddcb

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 b1c3ee9 commit 7c7ddcb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/EcrClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class EcrClient extends AbstractApi
3030
* @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-api.ecr-2015-09-21.html#getauthorizationtoken
3131
*
3232
* @param array{
33-
* registryIds?: string[],
33+
* registryIds?: null|string[],
3434
* '@region'?: string|null,
3535
* }|GetAuthorizationTokenRequest $input
3636
*

src/Input/GetAuthorizationTokenRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final class GetAuthorizationTokenRequest extends Input
1818

1919
/**
2020
* @param array{
21-
* registryIds?: string[],
21+
* registryIds?: null|string[],
2222
* '@region'?: string|null,
2323
* } $input
2424
*/
@@ -30,7 +30,7 @@ public function __construct(array $input = [])
3030

3131
/**
3232
* @param array{
33-
* registryIds?: string[],
33+
* registryIds?: null|string[],
3434
* '@region'?: string|null,
3535
* }|GetAuthorizationTokenRequest $input
3636
*/

0 commit comments

Comments
 (0)