Skip to content

Commit 8f8e295

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 0adf9b3 commit 8f8e295

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

src/Input/SendTaskFailureInput.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ final class SendTaskFailureInput extends Input
3838
/**
3939
* @param array{
4040
* taskToken?: string,
41-
* error?: string,
42-
* cause?: string,
41+
* error?: null|string,
42+
* cause?: null|string,
4343
* '@region'?: string|null,
4444
* } $input
4545
*/
@@ -54,8 +54,8 @@ public function __construct(array $input = [])
5454
/**
5555
* @param array{
5656
* taskToken?: string,
57-
* error?: string,
58-
* cause?: string,
57+
* error?: null|string,
58+
* cause?: null|string,
5959
* '@region'?: string|null,
6060
* }|SendTaskFailureInput $input
6161
*/

src/Input/StartExecutionInput.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ final class StartExecutionInput extends Input
8686
/**
8787
* @param array{
8888
* stateMachineArn?: string,
89-
* name?: string,
90-
* input?: string,
91-
* traceHeader?: string,
89+
* name?: null|string,
90+
* input?: null|string,
91+
* traceHeader?: null|string,
9292
* '@region'?: string|null,
9393
* } $input
9494
*/
@@ -104,9 +104,9 @@ public function __construct(array $input = [])
104104
/**
105105
* @param array{
106106
* stateMachineArn?: string,
107-
* name?: string,
108-
* input?: string,
109-
* traceHeader?: string,
107+
* name?: null|string,
108+
* input?: null|string,
109+
* traceHeader?: null|string,
110110
* '@region'?: string|null,
111111
* }|StartExecutionInput $input
112112
*/

src/Input/StopExecutionInput.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ final class StopExecutionInput extends Input
3535
/**
3636
* @param array{
3737
* executionArn?: string,
38-
* error?: string,
39-
* cause?: string,
38+
* error?: null|string,
39+
* cause?: null|string,
4040
* '@region'?: string|null,
4141
* } $input
4242
*/
@@ -51,8 +51,8 @@ public function __construct(array $input = [])
5151
/**
5252
* @param array{
5353
* executionArn?: string,
54-
* error?: string,
55-
* cause?: string,
54+
* error?: null|string,
55+
* cause?: null|string,
5656
* '@region'?: string|null,
5757
* }|StopExecutionInput $input
5858
*/

src/StepFunctionsClient.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class StepFunctionsClient extends AbstractApi
4444
*
4545
* @param array{
4646
* taskToken: string,
47-
* error?: string,
48-
* cause?: string,
47+
* error?: null|string,
48+
* cause?: null|string,
4949
* '@region'?: string|null,
5050
* }|SendTaskFailureInput $input
5151
*
@@ -186,9 +186,9 @@ public function sendTaskSuccess($input): SendTaskSuccessOutput
186186
*
187187
* @param array{
188188
* stateMachineArn: string,
189-
* name?: string,
190-
* input?: string,
191-
* traceHeader?: string,
189+
* name?: null|string,
190+
* input?: null|string,
191+
* traceHeader?: null|string,
192192
* '@region'?: string|null,
193193
* }|StartExecutionInput $input
194194
*
@@ -228,8 +228,8 @@ public function startExecution($input): StartExecutionOutput
228228
*
229229
* @param array{
230230
* executionArn: string,
231-
* error?: string,
232-
* cause?: string,
231+
* error?: null|string,
232+
* cause?: null|string,
233233
* '@region'?: string|null,
234234
* }|StopExecutionInput $input
235235
*

0 commit comments

Comments
 (0)