Skip to content

Commit 22c9b08

Browse files
authored
Generate the phpdoc for the static create method of objects (#1464)
1 parent f3807d1 commit 22c9b08

File tree

893 files changed

+7948
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

893 files changed

+7948
-9
lines changed

src/CodeGenerator/src/Generator/InputGenerator.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,16 @@ public function generate(Operation $operation): ClassName
270270
}
271271

272272
// Add named constructor
273-
$classBuilder->addMethod('create')
273+
$createMethod = $classBuilder->addMethod('create')
274274
->setStatic(true)
275275
->setReturnType('self')
276-
->setBody('return $input instanceof self ? $input : new self($input);')
277-
->addParameter('input');
276+
->setBody('return $input instanceof self ? $input : new self($input);');
277+
$createMethod->addParameter('input');
278+
[$doc, $memberClassNames] = $this->typeGenerator->generateDocblock($shape, $className, true, true, false, [' \'@region\'?: string|null,']);
279+
$createMethod->addComment($doc);
280+
foreach ($memberClassNames as $memberClassName) {
281+
$classBuilder->addUse($memberClassName->getFqdn());
282+
}
278283

279284
$constructorBody .= 'parent::__construct($input);';
280285
$constructor = $classBuilder->addMethod('__construct');

src/CodeGenerator/src/Generator/ObjectGenerator.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,30 @@ private function isShapeUsedInput(StructureShape $shape): bool
147147
private function namedConstructor(StructureShape $shape, ClassBuilder $classBuilder): void
148148
{
149149
if (empty($shape->getMembers())) {
150-
$classBuilder->addMethod('create')
150+
$createMethod = $classBuilder->addMethod('create')
151151
->setStatic(true)
152152
->setReturnType('self')
153-
->setBody('return $input instanceof self ? $input : new self();')
154-
->addParameter('input');
153+
->setBody('return $input instanceof self ? $input : new self();');
154+
$createMethod->addParameter('input');
155+
[$doc, $memberClassNames] = $this->typeGenerator->generateDocblock($shape, $this->generated[$shape->getName()], true, false, true);
156+
$createMethod->addComment($doc);
157+
foreach ($memberClassNames as $memberClassName) {
158+
$classBuilder->addUse($memberClassName->getFqdn());
159+
}
155160

156161
return;
157162
}
158163

159-
$classBuilder->addMethod('create')
164+
$createMethod = $classBuilder->addMethod('create')
160165
->setStatic(true)
161166
->setReturnType('self')
162-
->setBody('return $input instanceof self ? $input : new self($input);')
163-
->addParameter('input');
167+
->setBody('return $input instanceof self ? $input : new self($input);');
168+
$createMethod->addParameter('input');
169+
[$doc, $memberClassNames] = $this->typeGenerator->generateDocblock($shape, $this->generated[$shape->getName()], true, false, true);
170+
$createMethod->addComment($doc);
171+
foreach ($memberClassNames as $memberClassName) {
172+
$classBuilder->addUse($memberClassName->getFqdn());
173+
}
164174

165175
// We need a constructor
166176
$constructor = $classBuilder->addMethod('__construct');

src/Core/src/Sts/Input/AssumeRoleRequest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,22 @@ public function __construct(array $input = [])
260260
parent::__construct($input);
261261
}
262262

263+
/**
264+
* @param array{
265+
* RoleArn?: string,
266+
* RoleSessionName?: string,
267+
* PolicyArns?: PolicyDescriptorType[],
268+
* Policy?: string,
269+
* DurationSeconds?: int,
270+
* Tags?: Tag[],
271+
* TransitiveTagKeys?: string[],
272+
* ExternalId?: string,
273+
* SerialNumber?: string,
274+
* TokenCode?: string,
275+
* SourceIdentity?: string,
276+
* '@region'?: string|null,
277+
* }|AssumeRoleRequest $input
278+
*/
263279
public static function create($input): self
264280
{
265281
return $input instanceof self ? $input : new self($input);

src/Core/src/Sts/Input/AssumeRoleWithWebIdentityRequest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,18 @@ public function __construct(array $input = [])
153153
parent::__construct($input);
154154
}
155155

156+
/**
157+
* @param array{
158+
* RoleArn?: string,
159+
* RoleSessionName?: string,
160+
* WebIdentityToken?: string,
161+
* ProviderId?: string,
162+
* PolicyArns?: PolicyDescriptorType[],
163+
* Policy?: string,
164+
* DurationSeconds?: int,
165+
* '@region'?: string|null,
166+
* }|AssumeRoleWithWebIdentityRequest $input
167+
*/
156168
public static function create($input): self
157169
{
158170
return $input instanceof self ? $input : new self($input);

src/Core/src/Sts/Input/GetCallerIdentityRequest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ public function __construct(array $input = [])
1818
parent::__construct($input);
1919
}
2020

21+
/**
22+
* @param array{
23+
* '@region'?: string|null,
24+
* }|GetCallerIdentityRequest $input
25+
*/
2126
public static function create($input): self
2227
{
2328
return $input instanceof self ? $input : new self($input);

src/Core/src/Sts/ValueObject/AssumedRoleUser.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ public function __construct(array $input)
3333
$this->arn = $input['Arn'] ?? null;
3434
}
3535

36+
/**
37+
* @param array{
38+
* AssumedRoleId: string,
39+
* Arn: string,
40+
* }|AssumedRoleUser $input
41+
*/
3642
public static function create($input): self
3743
{
3844
return $input instanceof self ? $input : new self($input);

src/Core/src/Sts/ValueObject/Credentials.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ public function __construct(array $input)
4343
$this->expiration = $input['Expiration'] ?? null;
4444
}
4545

46+
/**
47+
* @param array{
48+
* AccessKeyId: string,
49+
* SecretAccessKey: string,
50+
* SessionToken: string,
51+
* Expiration: \DateTimeImmutable,
52+
* }|Credentials $input
53+
*/
4654
public static function create($input): self
4755
{
4856
return $input instanceof self ? $input : new self($input);

src/Core/src/Sts/ValueObject/PolicyDescriptorType.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ public function __construct(array $input)
2727
$this->arn = $input['arn'] ?? null;
2828
}
2929

30+
/**
31+
* @param array{
32+
* arn?: null|string,
33+
* }|PolicyDescriptorType $input
34+
*/
3035
public static function create($input): self
3136
{
3237
return $input instanceof self ? $input : new self($input);

src/Core/src/Sts/ValueObject/Tag.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ public function __construct(array $input)
4545
$this->value = $input['Value'] ?? null;
4646
}
4747

48+
/**
49+
* @param array{
50+
* Key: string,
51+
* Value: string,
52+
* }|Tag $input
53+
*/
4854
public static function create($input): self
4955
{
5056
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/Input/CreateResolverRequest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,24 @@ public function __construct(array $input = [])
157157
parent::__construct($input);
158158
}
159159

160+
/**
161+
* @param array{
162+
* apiId?: string,
163+
* typeName?: string,
164+
* fieldName?: string,
165+
* dataSourceName?: string,
166+
* requestMappingTemplate?: string,
167+
* responseMappingTemplate?: string,
168+
* kind?: ResolverKind::*,
169+
* pipelineConfig?: PipelineConfig|array,
170+
* syncConfig?: SyncConfig|array,
171+
* cachingConfig?: CachingConfig|array,
172+
* maxBatchSize?: int,
173+
* runtime?: AppSyncRuntime|array,
174+
* code?: string,
175+
* '@region'?: string|null,
176+
* }|CreateResolverRequest $input
177+
*/
160178
public static function create($input): self
161179
{
162180
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/Input/DeleteResolverRequest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ public function __construct(array $input = [])
5252
parent::__construct($input);
5353
}
5454

55+
/**
56+
* @param array{
57+
* apiId?: string,
58+
* typeName?: string,
59+
* fieldName?: string,
60+
* '@region'?: string|null,
61+
* }|DeleteResolverRequest $input
62+
*/
5563
public static function create($input): self
5664
{
5765
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/Input/GetSchemaCreationStatusRequest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ public function __construct(array $input = [])
3030
parent::__construct($input);
3131
}
3232

33+
/**
34+
* @param array{
35+
* apiId?: string,
36+
* '@region'?: string|null,
37+
* }|GetSchemaCreationStatusRequest $input
38+
*/
3339
public static function create($input): self
3440
{
3541
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/Input/ListApiKeysRequest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ public function __construct(array $input = [])
4949
parent::__construct($input);
5050
}
5151

52+
/**
53+
* @param array{
54+
* apiId?: string,
55+
* nextToken?: string,
56+
* maxResults?: int,
57+
* '@region'?: string|null,
58+
* }|ListApiKeysRequest $input
59+
*/
5260
public static function create($input): self
5361
{
5462
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/Input/ListResolversRequest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ public function __construct(array $input = [])
6060
parent::__construct($input);
6161
}
6262

63+
/**
64+
* @param array{
65+
* apiId?: string,
66+
* typeName?: string,
67+
* nextToken?: string,
68+
* maxResults?: int,
69+
* '@region'?: string|null,
70+
* }|ListResolversRequest $input
71+
*/
6372
public static function create($input): self
6473
{
6574
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/Input/StartSchemaCreationRequest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ public function __construct(array $input = [])
4141
parent::__construct($input);
4242
}
4343

44+
/**
45+
* @param array{
46+
* apiId?: string,
47+
* definition?: string,
48+
* '@region'?: string|null,
49+
* }|StartSchemaCreationRequest $input
50+
*/
4451
public static function create($input): self
4552
{
4653
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/Input/UpdateApiKeyRequest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,15 @@ public function __construct(array $input = [])
6060
parent::__construct($input);
6161
}
6262

63+
/**
64+
* @param array{
65+
* apiId?: string,
66+
* id?: string,
67+
* description?: string,
68+
* expires?: string,
69+
* '@region'?: string|null,
70+
* }|UpdateApiKeyRequest $input
71+
*/
6372
public static function create($input): self
6473
{
6574
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/Input/UpdateDataSourceRequest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,23 @@ public function __construct(array $input = [])
144144
parent::__construct($input);
145145
}
146146

147+
/**
148+
* @param array{
149+
* apiId?: string,
150+
* name?: string,
151+
* description?: string,
152+
* type?: DataSourceType::*,
153+
* serviceRoleArn?: string,
154+
* dynamodbConfig?: DynamodbDataSourceConfig|array,
155+
* lambdaConfig?: LambdaDataSourceConfig|array,
156+
* elasticsearchConfig?: ElasticsearchDataSourceConfig|array,
157+
* openSearchServiceConfig?: OpenSearchServiceDataSourceConfig|array,
158+
* httpConfig?: HttpDataSourceConfig|array,
159+
* relationalDatabaseConfig?: RelationalDatabaseDataSourceConfig|array,
160+
* eventBridgeConfig?: EventBridgeDataSourceConfig|array,
161+
* '@region'?: string|null,
162+
* }|UpdateDataSourceRequest $input
163+
*/
147164
public static function create($input): self
148165
{
149166
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/Input/UpdateResolverRequest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,24 @@ public function __construct(array $input = [])
157157
parent::__construct($input);
158158
}
159159

160+
/**
161+
* @param array{
162+
* apiId?: string,
163+
* typeName?: string,
164+
* fieldName?: string,
165+
* dataSourceName?: string,
166+
* requestMappingTemplate?: string,
167+
* responseMappingTemplate?: string,
168+
* kind?: ResolverKind::*,
169+
* pipelineConfig?: PipelineConfig|array,
170+
* syncConfig?: SyncConfig|array,
171+
* cachingConfig?: CachingConfig|array,
172+
* maxBatchSize?: int,
173+
* runtime?: AppSyncRuntime|array,
174+
* code?: string,
175+
* '@region'?: string|null,
176+
* }|UpdateResolverRequest $input
177+
*/
160178
public static function create($input): self
161179
{
162180
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/ValueObject/ApiKey.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ public function __construct(array $input)
7272
$this->deletes = $input['deletes'] ?? null;
7373
}
7474

75+
/**
76+
* @param array{
77+
* id?: null|string,
78+
* description?: null|string,
79+
* expires?: null|string,
80+
* deletes?: null|string,
81+
* }|ApiKey $input
82+
*/
7583
public static function create($input): self
7684
{
7785
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/ValueObject/AppSyncRuntime.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public function __construct(array $input)
3434
$this->runtimeVersion = $input['runtimeVersion'] ?? null;
3535
}
3636

37+
/**
38+
* @param array{
39+
* name: RuntimeName::*,
40+
* runtimeVersion: string,
41+
* }|AppSyncRuntime $input
42+
*/
3743
public static function create($input): self
3844
{
3945
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/ValueObject/AuthorizationConfig.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ public function __construct(array $input)
3434
$this->awsIamConfig = isset($input['awsIamConfig']) ? AwsIamConfig::create($input['awsIamConfig']) : null;
3535
}
3636

37+
/**
38+
* @param array{
39+
* authorizationType: AuthorizationType::*,
40+
* awsIamConfig?: null|AwsIamConfig|array,
41+
* }|AuthorizationConfig $input
42+
*/
3743
public static function create($input): self
3844
{
3945
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/ValueObject/AwsIamConfig.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public function __construct(array $input)
2929
$this->signingServiceName = $input['signingServiceName'] ?? null;
3030
}
3131

32+
/**
33+
* @param array{
34+
* signingRegion?: null|string,
35+
* signingServiceName?: null|string,
36+
* }|AwsIamConfig $input
37+
*/
3238
public static function create($input): self
3339
{
3440
return $input instanceof self ? $input : new self($input);

src/Service/AppSync/src/ValueObject/BadRequestDetail.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public function __construct(array $input)
2323
$this->codeErrors = isset($input['codeErrors']) ? array_map([CodeError::class, 'create'], $input['codeErrors']) : null;
2424
}
2525

26+
/**
27+
* @param array{
28+
* codeErrors?: null|CodeError[],
29+
* }|BadRequestDetail $input
30+
*/
2631
public static function create($input): self
2732
{
2833
return $input instanceof self ? $input : new self($input);

0 commit comments

Comments
 (0)