Skip to content

Commit 2671228

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 37a72d4 commit 2671228

File tree

2 files changed

+90
-90
lines changed

2 files changed

+90
-90
lines changed

src/CodeBuildClient.php

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -64,36 +64,36 @@ public function batchGetBuilds($input): BatchGetBuildsOutput
6464
*
6565
* @param array{
6666
* projectName: string,
67-
* secondarySourcesOverride?: array<ProjectSource|array>,
68-
* secondarySourcesVersionOverride?: array<ProjectSourceVersion|array>,
69-
* sourceVersion?: string,
70-
* artifactsOverride?: ProjectArtifacts|array,
71-
* secondaryArtifactsOverride?: array<ProjectArtifacts|array>,
72-
* environmentVariablesOverride?: array<EnvironmentVariable|array>,
73-
* sourceTypeOverride?: SourceType::*,
74-
* sourceLocationOverride?: string,
75-
* sourceAuthOverride?: SourceAuth|array,
76-
* gitCloneDepthOverride?: int,
77-
* gitSubmodulesConfigOverride?: GitSubmodulesConfig|array,
78-
* buildspecOverride?: string,
79-
* insecureSslOverride?: bool,
80-
* reportBuildStatusOverride?: bool,
81-
* buildStatusConfigOverride?: BuildStatusConfig|array,
82-
* environmentTypeOverride?: EnvironmentType::*,
83-
* imageOverride?: string,
84-
* computeTypeOverride?: ComputeType::*,
85-
* certificateOverride?: string,
86-
* cacheOverride?: ProjectCache|array,
87-
* serviceRoleOverride?: string,
88-
* privilegedModeOverride?: bool,
89-
* timeoutInMinutesOverride?: int,
90-
* queuedTimeoutInMinutesOverride?: int,
91-
* encryptionKeyOverride?: string,
92-
* idempotencyToken?: string,
93-
* logsConfigOverride?: LogsConfig|array,
94-
* registryCredentialOverride?: RegistryCredential|array,
95-
* imagePullCredentialsTypeOverride?: ImagePullCredentialsType::*,
96-
* debugSessionEnabled?: bool,
67+
* secondarySourcesOverride?: null|array<ProjectSource|array>,
68+
* secondarySourcesVersionOverride?: null|array<ProjectSourceVersion|array>,
69+
* sourceVersion?: null|string,
70+
* artifactsOverride?: null|ProjectArtifacts|array,
71+
* secondaryArtifactsOverride?: null|array<ProjectArtifacts|array>,
72+
* environmentVariablesOverride?: null|array<EnvironmentVariable|array>,
73+
* sourceTypeOverride?: null|SourceType::*,
74+
* sourceLocationOverride?: null|string,
75+
* sourceAuthOverride?: null|SourceAuth|array,
76+
* gitCloneDepthOverride?: null|int,
77+
* gitSubmodulesConfigOverride?: null|GitSubmodulesConfig|array,
78+
* buildspecOverride?: null|string,
79+
* insecureSslOverride?: null|bool,
80+
* reportBuildStatusOverride?: null|bool,
81+
* buildStatusConfigOverride?: null|BuildStatusConfig|array,
82+
* environmentTypeOverride?: null|EnvironmentType::*,
83+
* imageOverride?: null|string,
84+
* computeTypeOverride?: null|ComputeType::*,
85+
* certificateOverride?: null|string,
86+
* cacheOverride?: null|ProjectCache|array,
87+
* serviceRoleOverride?: null|string,
88+
* privilegedModeOverride?: null|bool,
89+
* timeoutInMinutesOverride?: null|int,
90+
* queuedTimeoutInMinutesOverride?: null|int,
91+
* encryptionKeyOverride?: null|string,
92+
* idempotencyToken?: null|string,
93+
* logsConfigOverride?: null|LogsConfig|array,
94+
* registryCredentialOverride?: null|RegistryCredential|array,
95+
* imagePullCredentialsTypeOverride?: null|ImagePullCredentialsType::*,
96+
* debugSessionEnabled?: null|bool,
9797
* '@region'?: string|null,
9898
* }|StartBuildInput $input
9999
*

src/Input/StartBuildInput.php

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -322,36 +322,36 @@ final class StartBuildInput extends Input
322322
/**
323323
* @param array{
324324
* projectName?: string,
325-
* secondarySourcesOverride?: array<ProjectSource|array>,
326-
* secondarySourcesVersionOverride?: array<ProjectSourceVersion|array>,
327-
* sourceVersion?: string,
328-
* artifactsOverride?: ProjectArtifacts|array,
329-
* secondaryArtifactsOverride?: array<ProjectArtifacts|array>,
330-
* environmentVariablesOverride?: array<EnvironmentVariable|array>,
331-
* sourceTypeOverride?: SourceType::*,
332-
* sourceLocationOverride?: string,
333-
* sourceAuthOverride?: SourceAuth|array,
334-
* gitCloneDepthOverride?: int,
335-
* gitSubmodulesConfigOverride?: GitSubmodulesConfig|array,
336-
* buildspecOverride?: string,
337-
* insecureSslOverride?: bool,
338-
* reportBuildStatusOverride?: bool,
339-
* buildStatusConfigOverride?: BuildStatusConfig|array,
340-
* environmentTypeOverride?: EnvironmentType::*,
341-
* imageOverride?: string,
342-
* computeTypeOverride?: ComputeType::*,
343-
* certificateOverride?: string,
344-
* cacheOverride?: ProjectCache|array,
345-
* serviceRoleOverride?: string,
346-
* privilegedModeOverride?: bool,
347-
* timeoutInMinutesOverride?: int,
348-
* queuedTimeoutInMinutesOverride?: int,
349-
* encryptionKeyOverride?: string,
350-
* idempotencyToken?: string,
351-
* logsConfigOverride?: LogsConfig|array,
352-
* registryCredentialOverride?: RegistryCredential|array,
353-
* imagePullCredentialsTypeOverride?: ImagePullCredentialsType::*,
354-
* debugSessionEnabled?: bool,
325+
* secondarySourcesOverride?: null|array<ProjectSource|array>,
326+
* secondarySourcesVersionOverride?: null|array<ProjectSourceVersion|array>,
327+
* sourceVersion?: null|string,
328+
* artifactsOverride?: null|ProjectArtifacts|array,
329+
* secondaryArtifactsOverride?: null|array<ProjectArtifacts|array>,
330+
* environmentVariablesOverride?: null|array<EnvironmentVariable|array>,
331+
* sourceTypeOverride?: null|SourceType::*,
332+
* sourceLocationOverride?: null|string,
333+
* sourceAuthOverride?: null|SourceAuth|array,
334+
* gitCloneDepthOverride?: null|int,
335+
* gitSubmodulesConfigOverride?: null|GitSubmodulesConfig|array,
336+
* buildspecOverride?: null|string,
337+
* insecureSslOverride?: null|bool,
338+
* reportBuildStatusOverride?: null|bool,
339+
* buildStatusConfigOverride?: null|BuildStatusConfig|array,
340+
* environmentTypeOverride?: null|EnvironmentType::*,
341+
* imageOverride?: null|string,
342+
* computeTypeOverride?: null|ComputeType::*,
343+
* certificateOverride?: null|string,
344+
* cacheOverride?: null|ProjectCache|array,
345+
* serviceRoleOverride?: null|string,
346+
* privilegedModeOverride?: null|bool,
347+
* timeoutInMinutesOverride?: null|int,
348+
* queuedTimeoutInMinutesOverride?: null|int,
349+
* encryptionKeyOverride?: null|string,
350+
* idempotencyToken?: null|string,
351+
* logsConfigOverride?: null|LogsConfig|array,
352+
* registryCredentialOverride?: null|RegistryCredential|array,
353+
* imagePullCredentialsTypeOverride?: null|ImagePullCredentialsType::*,
354+
* debugSessionEnabled?: null|bool,
355355
* '@region'?: string|null,
356356
* } $input
357357
*/
@@ -394,36 +394,36 @@ public function __construct(array $input = [])
394394
/**
395395
* @param array{
396396
* projectName?: string,
397-
* secondarySourcesOverride?: array<ProjectSource|array>,
398-
* secondarySourcesVersionOverride?: array<ProjectSourceVersion|array>,
399-
* sourceVersion?: string,
400-
* artifactsOverride?: ProjectArtifacts|array,
401-
* secondaryArtifactsOverride?: array<ProjectArtifacts|array>,
402-
* environmentVariablesOverride?: array<EnvironmentVariable|array>,
403-
* sourceTypeOverride?: SourceType::*,
404-
* sourceLocationOverride?: string,
405-
* sourceAuthOverride?: SourceAuth|array,
406-
* gitCloneDepthOverride?: int,
407-
* gitSubmodulesConfigOverride?: GitSubmodulesConfig|array,
408-
* buildspecOverride?: string,
409-
* insecureSslOverride?: bool,
410-
* reportBuildStatusOverride?: bool,
411-
* buildStatusConfigOverride?: BuildStatusConfig|array,
412-
* environmentTypeOverride?: EnvironmentType::*,
413-
* imageOverride?: string,
414-
* computeTypeOverride?: ComputeType::*,
415-
* certificateOverride?: string,
416-
* cacheOverride?: ProjectCache|array,
417-
* serviceRoleOverride?: string,
418-
* privilegedModeOverride?: bool,
419-
* timeoutInMinutesOverride?: int,
420-
* queuedTimeoutInMinutesOverride?: int,
421-
* encryptionKeyOverride?: string,
422-
* idempotencyToken?: string,
423-
* logsConfigOverride?: LogsConfig|array,
424-
* registryCredentialOverride?: RegistryCredential|array,
425-
* imagePullCredentialsTypeOverride?: ImagePullCredentialsType::*,
426-
* debugSessionEnabled?: bool,
397+
* secondarySourcesOverride?: null|array<ProjectSource|array>,
398+
* secondarySourcesVersionOverride?: null|array<ProjectSourceVersion|array>,
399+
* sourceVersion?: null|string,
400+
* artifactsOverride?: null|ProjectArtifacts|array,
401+
* secondaryArtifactsOverride?: null|array<ProjectArtifacts|array>,
402+
* environmentVariablesOverride?: null|array<EnvironmentVariable|array>,
403+
* sourceTypeOverride?: null|SourceType::*,
404+
* sourceLocationOverride?: null|string,
405+
* sourceAuthOverride?: null|SourceAuth|array,
406+
* gitCloneDepthOverride?: null|int,
407+
* gitSubmodulesConfigOverride?: null|GitSubmodulesConfig|array,
408+
* buildspecOverride?: null|string,
409+
* insecureSslOverride?: null|bool,
410+
* reportBuildStatusOverride?: null|bool,
411+
* buildStatusConfigOverride?: null|BuildStatusConfig|array,
412+
* environmentTypeOverride?: null|EnvironmentType::*,
413+
* imageOverride?: null|string,
414+
* computeTypeOverride?: null|ComputeType::*,
415+
* certificateOverride?: null|string,
416+
* cacheOverride?: null|ProjectCache|array,
417+
* serviceRoleOverride?: null|string,
418+
* privilegedModeOverride?: null|bool,
419+
* timeoutInMinutesOverride?: null|int,
420+
* queuedTimeoutInMinutesOverride?: null|int,
421+
* encryptionKeyOverride?: null|string,
422+
* idempotencyToken?: null|string,
423+
* logsConfigOverride?: null|LogsConfig|array,
424+
* registryCredentialOverride?: null|RegistryCredential|array,
425+
* imagePullCredentialsTypeOverride?: null|ImagePullCredentialsType::*,
426+
* debugSessionEnabled?: null|bool,
427427
* '@region'?: string|null,
428428
* }|StartBuildInput $input
429429
*/

0 commit comments

Comments
 (0)