Skip to content

Commit d53f481

Browse files
committed
Generate the property type for generated objects
1 parent 868ebbe commit d53f481

File tree

877 files changed

+7053
-1
lines changed

Some content is hidden

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

877 files changed

+7053
-1
lines changed

psalm.baseline.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,11 @@
288288
<code><![CDATA[list<Reason::*>]]></code>
289289
</MoreSpecificReturnType>
290290
</file>
291+
<file src="src/Service/Route53/src/Result/CreateHostedZoneResponse.php">
292+
<PossiblyNullPropertyAssignmentValue>
293+
<code><![CDATA[$headers['location'][0] ?? null]]></code>
294+
</PossiblyNullPropertyAssignmentValue>
295+
</file>
291296
<file src="src/Service/S3/src/Result/ListObjectsV2Output.php">
292297
<LessSpecificReturnStatement>
293298
<code>$items</code>
@@ -307,4 +312,14 @@
307312
<code>empty($s3SignerOptions)</code>
308313
</TypeDoesNotContainType>
309314
</file>
315+
<file src="src/Service/StepFunctions/src/Result/StartExecutionOutput.php">
316+
<PossiblyFalsePropertyAssignmentValue>
317+
<code><![CDATA[$d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $data['startDate']))]]></code>
318+
</PossiblyFalsePropertyAssignmentValue>
319+
</file>
320+
<file src="src/Service/StepFunctions/src/Result/StopExecutionOutput.php">
321+
<PossiblyFalsePropertyAssignmentValue>
322+
<code><![CDATA[$d = \DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', $data['stopDate']))]]></code>
323+
</PossiblyFalsePropertyAssignmentValue>
324+
</file>
310325
</files>

src/CodeGenerator/src/Generator/CodeGenerator/PopulatorGenerator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ private function generateProperties(StructureShape $shape, ClassBuilder $classBu
132132
$nullable = false;
133133
} elseif ($member->isStreaming()) {
134134
$returnType = ResultStream::class;
135-
$parameterType = ResultStream::class;
135+
$parameterType = 'ResultStream';
136136
$memberClassNames = [];
137+
$classBuilder->addUse(ResultStream::class);
137138
$nullable = false;
138139
}
139140

@@ -160,6 +161,9 @@ private function generateProperties(StructureShape $shape, ClassBuilder $classBu
160161
$method->addComment('@return ' . $parameterType . ($nullable ? '|null' : ''));
161162
}
162163
$method->setReturnNullable($nullable);
164+
if ($parameterType) {
165+
$property->addComment('@var ' . $parameterType . ($nullable ? '|null' : ''));
166+
}
163167
}
164168

165169
if ($forEndpoint) {

src/CodeGenerator/src/Generator/ObjectGenerator.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,9 @@ private function addProperties(StructureShape $shape, ClassBuilder $classBuilder
342342
$method->addComment('@return ' . $parameterType . ($getterSetterNullable ? '|null' : ''));
343343
}
344344
$method->setReturnNullable($getterSetterNullable);
345+
if ($parameterType) {
346+
$property->addComment('@var ' . $parameterType . ($nullable ? '|null' : ''));
347+
}
345348
}
346349

347350
foreach ($forEndpointProps as $key => $ok) {

src/Core/src/Sts/Result/AssumeRoleResponse.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class AssumeRoleResponse extends Result
1919
*
2020
* > The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no
2121
* > assumptions about the maximum size.
22+
*
23+
* @var Credentials|null
2224
*/
2325
private $credentials;
2426

@@ -27,13 +29,17 @@ class AssumeRoleResponse extends Result
2729
* resulting temporary security credentials. For example, you can reference these credentials as a principal in a
2830
* resource-based policy by using the ARN or assumed role ID. The ARN and ID include the `RoleSessionName` that you
2931
* specified when you called `AssumeRole`.
32+
*
33+
* @var AssumedRoleUser|null
3034
*/
3135
private $assumedRoleUser;
3236

3337
/**
3438
* A percentage value that indicates the packed size of the session policies and session tags combined passed in the
3539
* request. The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded
3640
* the allowed space.
41+
*
42+
* @var int|null
3743
*/
3844
private $packedPolicySize;
3945

@@ -50,6 +56,8 @@ class AssumeRoleResponse extends Result
5056
* characters with no spaces. You can also include underscores or any of the following characters: =,.@-
5157
*
5258
* [^1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html
59+
*
60+
* @var string|null
5361
*/
5462
private $sourceIdentity;
5563

src/Core/src/Sts/Result/AssumeRoleWithWebIdentityResponse.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class AssumeRoleWithWebIdentityResponse extends Result
1818
*
1919
* > The size of the security token that STS API operations return is not fixed. We strongly recommend that you make no
2020
* > assumptions about the maximum size.
21+
*
22+
* @var Credentials|null
2123
*/
2224
private $credentials;
2325

@@ -26,6 +28,8 @@ class AssumeRoleWithWebIdentityResponse extends Result
2628
* `WebIdentityToken` that was submitted with the `AssumeRoleWithWebIdentity` call. The identifier is typically unique
2729
* to the user and the application that acquired the `WebIdentityToken` (pairwise identifier). For OpenID Connect ID
2830
* tokens, this field contains the value returned by the identity provider as the token's `sub` (Subject) claim.
31+
*
32+
* @var string|null
2933
*/
3034
private $subjectFromWebIdentityToken;
3135

@@ -34,26 +38,34 @@ class AssumeRoleWithWebIdentityResponse extends Result
3438
* resulting temporary security credentials. For example, you can reference these credentials as a principal in a
3539
* resource-based policy by using the ARN or assumed role ID. The ARN and ID include the `RoleSessionName` that you
3640
* specified when you called `AssumeRole`.
41+
*
42+
* @var AssumedRoleUser|null
3743
*/
3844
private $assumedRoleUser;
3945

4046
/**
4147
* A percentage value that indicates the packed size of the session policies and session tags combined passed in the
4248
* request. The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded
4349
* the allowed space.
50+
*
51+
* @var int|null
4452
*/
4553
private $packedPolicySize;
4654

4755
/**
4856
* The issuing authority of the web identity token presented. For OpenID Connect ID tokens, this contains the value of
4957
* the `iss` field. For OAuth 2.0 access tokens, this contains the value of the `ProviderId` parameter that was passed
5058
* in the `AssumeRoleWithWebIdentity` request.
59+
*
60+
* @var string|null
5161
*/
5262
private $provider;
5363

5464
/**
5565
* The intended audience (also known as client ID) of the web identity token. This is traditionally the client
5666
* identifier issued to the application that requested the web identity token.
67+
*
68+
* @var string|null
5769
*/
5870
private $audience;
5971

@@ -76,6 +88,8 @@ class AssumeRoleWithWebIdentityResponse extends Result
7688
* [^1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts#iam-term-role-chaining
7789
* [^2]: https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-with-identity-providers.html
7890
* [^3]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_monitor.html
91+
*
92+
* @var string|null
7993
*/
8094
private $sourceIdentity;
8195

src/Core/src/Sts/Result/GetCallerIdentityResponse.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,22 @@ class GetCallerIdentityResponse extends Result
1717
* Variables** reference page in the *IAM User Guide*.
1818
*
1919
* [^1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable
20+
*
21+
* @var string|null
2022
*/
2123
private $userId;
2224

2325
/**
2426
* The Amazon Web Services account ID number of the account that owns or contains the calling entity.
27+
*
28+
* @var string|null
2529
*/
2630
private $account;
2731

2832
/**
2933
* The Amazon Web Services ARN associated with the calling entity.
34+
*
35+
* @var string|null
3036
*/
3137
private $arn;
3238

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ final class AssumedRoleUser
1212
/**
1313
* A unique identifier that contains the role ID and the role session name of the role that is being assumed. The role
1414
* ID is generated by Amazon Web Services when the role is created.
15+
*
16+
* @var string
1517
*/
1618
private $assumedRoleId;
1719

@@ -20,6 +22,8 @@ final class AssumedRoleUser
2022
* about ARNs and how to use them in policies, see IAM Identifiers [^1] in the *IAM User Guide*.
2123
*
2224
* [^1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html
25+
*
26+
* @var string
2327
*/
2428
private $arn;
2529

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,29 @@ final class Credentials
1111
{
1212
/**
1313
* The access key ID that identifies the temporary security credentials.
14+
*
15+
* @var string
1416
*/
1517
private $accessKeyId;
1618

1719
/**
1820
* The secret access key that can be used to sign requests.
21+
*
22+
* @var string
1923
*/
2024
private $secretAccessKey;
2125

2226
/**
2327
* The token that users must pass to the service API to use the temporary credentials.
28+
*
29+
* @var string
2430
*/
2531
private $sessionToken;
2632

2733
/**
2834
* The date on which the current credentials expire.
35+
*
36+
* @var \DateTimeImmutable
2937
*/
3038
private $expiration;
3139

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ final class PolicyDescriptorType
1414
* *Amazon Web Services General Reference*.
1515
*
1616
* [^1]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
17+
*
18+
* @var string|null
1719
*/
1820
private $arn;
1921

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ final class Tag
2020
* additional limits, see IAM and STS Character Limits [^1] in the *IAM User Guide*.
2121
*
2222
* [^1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length
23+
*
24+
* @var string
2325
*/
2426
private $key;
2527

@@ -30,6 +32,8 @@ final class Tag
3032
* additional limits, see IAM and STS Character Limits [^1] in the *IAM User Guide*.
3133
*
3234
* [^1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length
35+
*
36+
* @var string
3337
*/
3438
private $value;
3539

src/Service/AppSync/src/Exception/BadRequestException.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@
1515
*/
1616
final class BadRequestException extends ClientException
1717
{
18+
/**
19+
* @var BadRequestReason::*|null
20+
*/
1821
private $reason;
1922

23+
/**
24+
* @var BadRequestDetail|null
25+
*/
2026
private $detail;
2127

2228
public function getDetail(): ?BadRequestDetail

src/Service/AppSync/src/Result/CreateResolverResponse.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class CreateResolverResponse extends Result
1515
{
1616
/**
1717
* The `Resolver` object.
18+
*
19+
* @var Resolver|null
1820
*/
1921
private $resolver;
2022

src/Service/AppSync/src/Result/GetSchemaCreationStatusResponse.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@ class GetSchemaCreationStatusResponse extends Result
1111
/**
1212
* The current state of the schema (PROCESSING, FAILED, SUCCESS, or NOT_APPLICABLE). When the schema is in the ACTIVE
1313
* state, you can add data.
14+
*
15+
* @var SchemaStatus::*|null
1416
*/
1517
private $status;
1618

1719
/**
1820
* Detailed information about the status of the schema creation operation.
21+
*
22+
* @var string|null
1923
*/
2024
private $details;
2125

src/Service/AppSync/src/Result/ListApiKeysResponse.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ class ListApiKeysResponse extends Result
1010
{
1111
/**
1212
* The `ApiKey` objects.
13+
*
14+
* @var ApiKey[]
1315
*/
1416
private $apiKeys;
1517

1618
/**
1719
* An identifier to pass in the next request to this operation to return the next set of items in the list.
20+
*
21+
* @var string|null
1822
*/
1923
private $nextToken;
2024

src/Service/AppSync/src/Result/ListResolversResponse.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@ class ListResolversResponse extends Result
1515
{
1616
/**
1717
* The `Resolver` objects.
18+
*
19+
* @var Resolver[]
1820
*/
1921
private $resolvers;
2022

2123
/**
2224
* An identifier to pass in the next request to this operation to return the next set of items in the list.
25+
*
26+
* @var string|null
2327
*/
2428
private $nextToken;
2529

src/Service/AppSync/src/Result/StartSchemaCreationResponse.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class StartSchemaCreationResponse extends Result
1111
/**
1212
* The current state of the schema (PROCESSING, FAILED, SUCCESS, or NOT_APPLICABLE). When the schema is in the ACTIVE
1313
* state, you can add data.
14+
*
15+
* @var SchemaStatus::*|null
1416
*/
1517
private $status;
1618

src/Service/AppSync/src/Result/UpdateApiKeyResponse.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class UpdateApiKeyResponse extends Result
1010
{
1111
/**
1212
* The API key.
13+
*
14+
* @var ApiKey|null
1315
*/
1416
private $apiKey;
1517

src/Service/AppSync/src/Result/UpdateDataSourceResponse.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class UpdateDataSourceResponse extends Result
2121
{
2222
/**
2323
* The updated `DataSource` object.
24+
*
25+
* @var DataSource|null
2426
*/
2527
private $dataSource;
2628

src/Service/AppSync/src/Result/UpdateResolverResponse.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class UpdateResolverResponse extends Result
1515
{
1616
/**
1717
* The updated `Resolver` object.
18+
*
19+
* @var Resolver|null
1820
*/
1921
private $resolver;
2022

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,31 @@ final class ApiKey
3636
{
3737
/**
3838
* The API key ID.
39+
*
40+
* @var string|null
3941
*/
4042
private $id;
4143

4244
/**
4345
* A description of the purpose of the API key.
46+
*
47+
* @var string|null
4448
*/
4549
private $description;
4650

4751
/**
4852
* The time after which the API key expires. The date is represented as seconds since the epoch, rounded down to the
4953
* nearest hour.
54+
*
55+
* @var int|null
5056
*/
5157
private $expires;
5258

5359
/**
5460
* The time after which the API key is deleted. The date is represented as seconds since the epoch, rounded down to the
5561
* nearest hour.
62+
*
63+
* @var int|null
5664
*/
5765
private $deletes;
5866

0 commit comments

Comments
 (0)