Skip to content

Commit 96fe0f9

Browse files
authored
Shortener Const docbloc (#265)
1 parent 2469db6 commit 96fe0f9

11 files changed

+91
-70
lines changed

src/Enum/InvocationType.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,15 @@ class InvocationType
77
public const DRY_RUN = 'DryRun';
88
public const EVENT = 'Event';
99
public const REQUEST_RESPONSE = 'RequestResponse';
10-
public const AVAILABLE_INVOCATIONTYPE = [
11-
self::DRY_RUN => true,
12-
self::EVENT => true,
13-
self::REQUEST_RESPONSE => true,
14-
];
10+
11+
public static function exists(string $value): bool
12+
{
13+
$values = [
14+
self::DRY_RUN => true,
15+
self::EVENT => true,
16+
self::REQUEST_RESPONSE => true,
17+
];
18+
19+
return isset($values[$value]);
20+
}
1521
}

src/Enum/LogType.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ class LogType
66
{
77
public const NONE = 'None';
88
public const TAIL = 'Tail';
9-
public const AVAILABLE_LOGTYPE = [
10-
self::NONE => true,
11-
self::TAIL => true,
12-
];
9+
10+
public static function exists(string $value): bool
11+
{
12+
$values = [
13+
self::NONE => true,
14+
self::TAIL => true,
15+
];
16+
17+
return isset($values[$value]);
18+
}
1319
}

src/Enum/Runtime.php

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,31 @@ class Runtime
2323
public const PYTHON_3_7 = 'python3.7';
2424
public const PYTHON_3_8 = 'python3.8';
2525
public const RUBY_2_5 = 'ruby2.5';
26-
public const AVAILABLE_RUNTIME = [
27-
self::DOTNETCORE_1_0 => true,
28-
self::DOTNETCORE_2_0 => true,
29-
self::DOTNETCORE_2_1 => true,
30-
self::GO_1_X => true,
31-
self::JAVA_11 => true,
32-
self::JAVA_8 => true,
33-
self::NODEJS => true,
34-
self::NODEJS_10_X => true,
35-
self::NODEJS_12_X => true,
36-
self::NODEJS_4_3 => true,
37-
self::NODEJS_4_3_EDGE => true,
38-
self::NODEJS_6_10 => true,
39-
self::NODEJS_8_10 => true,
40-
self::PROVIDED => true,
41-
self::PYTHON_2_7 => true,
42-
self::PYTHON_3_6 => true,
43-
self::PYTHON_3_7 => true,
44-
self::PYTHON_3_8 => true,
45-
self::RUBY_2_5 => true,
46-
];
26+
27+
public static function exists(string $value): bool
28+
{
29+
$values = [
30+
self::DOTNETCORE_1_0 => true,
31+
self::DOTNETCORE_2_0 => true,
32+
self::DOTNETCORE_2_1 => true,
33+
self::GO_1_X => true,
34+
self::JAVA_11 => true,
35+
self::JAVA_8 => true,
36+
self::NODEJS => true,
37+
self::NODEJS_10_X => true,
38+
self::NODEJS_12_X => true,
39+
self::NODEJS_4_3 => true,
40+
self::NODEJS_4_3_EDGE => true,
41+
self::NODEJS_6_10 => true,
42+
self::NODEJS_8_10 => true,
43+
self::PROVIDED => true,
44+
self::PYTHON_2_7 => true,
45+
self::PYTHON_3_6 => true,
46+
self::PYTHON_3_7 => true,
47+
self::PYTHON_3_8 => true,
48+
self::RUBY_2_5 => true,
49+
];
50+
51+
return isset($values[$value]);
52+
}
4753
}

src/Input/InvocationRequest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ class InvocationRequest
2020
/**
2121
* Choose from the following options.
2222
*
23-
* @var InvocationType::EVENT|InvocationType::REQUEST_RESPONSE|InvocationType::DRY_RUN|null
23+
* @var InvocationType::*|null
2424
*/
2525
private $InvocationType;
2626

2727
/**
2828
* Set to `Tail` to include the execution log in the response.
2929
*
30-
* @var LogType::NONE|LogType::TAIL|null
30+
* @var LogType::*|null
3131
*/
3232
private $LogType;
3333

@@ -55,8 +55,8 @@ class InvocationRequest
5555
/**
5656
* @param array{
5757
* FunctionName?: string,
58-
* InvocationType?: \AsyncAws\Lambda\Enum\InvocationType::EVENT|\AsyncAws\Lambda\Enum\InvocationType::REQUEST_RESPONSE|\AsyncAws\Lambda\Enum\InvocationType::DRY_RUN,
59-
* LogType?: \AsyncAws\Lambda\Enum\LogType::NONE|\AsyncAws\Lambda\Enum\LogType::TAIL,
58+
* InvocationType?: \AsyncAws\Lambda\Enum\InvocationType::*,
59+
* LogType?: \AsyncAws\Lambda\Enum\LogType::*,
6060
* ClientContext?: string,
6161
* Payload?: string,
6262
* Qualifier?: string,
@@ -88,15 +88,15 @@ public function getFunctionName(): ?string
8888
}
8989

9090
/**
91-
* @return InvocationType::EVENT|InvocationType::REQUEST_RESPONSE|InvocationType::DRY_RUN|null
91+
* @return InvocationType::*|null
9292
*/
9393
public function getInvocationType(): ?string
9494
{
9595
return $this->InvocationType;
9696
}
9797

9898
/**
99-
* @return LogType::NONE|LogType::TAIL|null
99+
* @return LogType::*|null
100100
*/
101101
public function getLogType(): ?string
102102
{
@@ -167,7 +167,7 @@ public function setFunctionName(?string $value): self
167167
}
168168

169169
/**
170-
* @param InvocationType::EVENT|InvocationType::REQUEST_RESPONSE|InvocationType::DRY_RUN|null $value
170+
* @param InvocationType::*|null $value
171171
*/
172172
public function setInvocationType(?string $value): self
173173
{
@@ -177,7 +177,7 @@ public function setInvocationType(?string $value): self
177177
}
178178

179179
/**
180-
* @param LogType::NONE|LogType::TAIL|null $value
180+
* @param LogType::*|null $value
181181
*/
182182
public function setLogType(?string $value): self
183183
{
@@ -207,14 +207,14 @@ public function validate(): void
207207
}
208208

209209
if (null !== $this->InvocationType) {
210-
if (!isset(InvocationType::AVAILABLE_INVOCATIONTYPE[$this->InvocationType])) {
211-
throw new InvalidArgument(sprintf('Invalid parameter "InvocationType" when validating the "%s". The value "%s" is not a valid "InvocationType". Available values are %s.', __CLASS__, $this->InvocationType, implode(', ', array_keys(InvocationType::AVAILABLE_INVOCATIONTYPE))));
210+
if (!InvocationType::exists($this->InvocationType)) {
211+
throw new InvalidArgument(sprintf('Invalid parameter "InvocationType" when validating the "%s". The value "%s" is not a valid "InvocationType".', __CLASS__, $this->InvocationType));
212212
}
213213
}
214214

215215
if (null !== $this->LogType) {
216-
if (!isset(LogType::AVAILABLE_LOGTYPE[$this->LogType])) {
217-
throw new InvalidArgument(sprintf('Invalid parameter "LogType" when validating the "%s". The value "%s" is not a valid "LogType". Available values are %s.', __CLASS__, $this->LogType, implode(', ', array_keys(LogType::AVAILABLE_LOGTYPE))));
216+
if (!LogType::exists($this->LogType)) {
217+
throw new InvalidArgument(sprintf('Invalid parameter "LogType" when validating the "%s". The value "%s" is not a valid "LogType".', __CLASS__, $this->LogType));
218218
}
219219
}
220220
}

src/Input/ListLayerVersionsRequest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ListLayerVersionsRequest
1010
/**
1111
* A runtime identifier. For example, `go1.x`.
1212
*
13-
* @var Runtime::NODEJS|Runtime::NODEJS_4_3|Runtime::NODEJS_6_10|Runtime::NODEJS_8_10|Runtime::NODEJS_10_X|Runtime::NODEJS_12_X|Runtime::JAVA_8|Runtime::JAVA_11|Runtime::PYTHON_2_7|Runtime::PYTHON_3_6|Runtime::PYTHON_3_7|Runtime::PYTHON_3_8|Runtime::DOTNETCORE_1_0|Runtime::DOTNETCORE_2_0|Runtime::DOTNETCORE_2_1|Runtime::NODEJS_4_3_EDGE|Runtime::GO_1_X|Runtime::RUBY_2_5|Runtime::PROVIDED|null
13+
* @var Runtime::*|null
1414
*/
1515
private $CompatibleRuntime;
1616

@@ -39,7 +39,7 @@ class ListLayerVersionsRequest
3939

4040
/**
4141
* @param array{
42-
* CompatibleRuntime?: \AsyncAws\Lambda\Enum\Runtime::NODEJS|\AsyncAws\Lambda\Enum\Runtime::NODEJS_4_3|\AsyncAws\Lambda\Enum\Runtime::NODEJS_6_10|\AsyncAws\Lambda\Enum\Runtime::NODEJS_8_10|\AsyncAws\Lambda\Enum\Runtime::NODEJS_10_X|\AsyncAws\Lambda\Enum\Runtime::NODEJS_12_X|\AsyncAws\Lambda\Enum\Runtime::JAVA_8|\AsyncAws\Lambda\Enum\Runtime::JAVA_11|\AsyncAws\Lambda\Enum\Runtime::PYTHON_2_7|\AsyncAws\Lambda\Enum\Runtime::PYTHON_3_6|\AsyncAws\Lambda\Enum\Runtime::PYTHON_3_7|\AsyncAws\Lambda\Enum\Runtime::PYTHON_3_8|\AsyncAws\Lambda\Enum\Runtime::DOTNETCORE_1_0|\AsyncAws\Lambda\Enum\Runtime::DOTNETCORE_2_0|\AsyncAws\Lambda\Enum\Runtime::DOTNETCORE_2_1|\AsyncAws\Lambda\Enum\Runtime::NODEJS_4_3_EDGE|\AsyncAws\Lambda\Enum\Runtime::GO_1_X|\AsyncAws\Lambda\Enum\Runtime::RUBY_2_5|\AsyncAws\Lambda\Enum\Runtime::PROVIDED,
42+
* CompatibleRuntime?: \AsyncAws\Lambda\Enum\Runtime::*,
4343
* LayerName?: string,
4444
* Marker?: string,
4545
* MaxItems?: int,
@@ -59,7 +59,7 @@ public static function create($input): self
5959
}
6060

6161
/**
62-
* @return Runtime::NODEJS|Runtime::NODEJS_4_3|Runtime::NODEJS_6_10|Runtime::NODEJS_8_10|Runtime::NODEJS_10_X|Runtime::NODEJS_12_X|Runtime::JAVA_8|Runtime::JAVA_11|Runtime::PYTHON_2_7|Runtime::PYTHON_3_6|Runtime::PYTHON_3_7|Runtime::PYTHON_3_8|Runtime::DOTNETCORE_1_0|Runtime::DOTNETCORE_2_0|Runtime::DOTNETCORE_2_1|Runtime::NODEJS_4_3_EDGE|Runtime::GO_1_X|Runtime::RUBY_2_5|Runtime::PROVIDED|null
62+
* @return Runtime::*|null
6363
*/
6464
public function getCompatibleRuntime(): ?string
6565
{
@@ -118,7 +118,7 @@ public function requestUri(): string
118118
}
119119

120120
/**
121-
* @param Runtime::NODEJS|Runtime::NODEJS_4_3|Runtime::NODEJS_6_10|Runtime::NODEJS_8_10|Runtime::NODEJS_10_X|Runtime::NODEJS_12_X|Runtime::JAVA_8|Runtime::JAVA_11|Runtime::PYTHON_2_7|Runtime::PYTHON_3_6|Runtime::PYTHON_3_7|Runtime::PYTHON_3_8|Runtime::DOTNETCORE_1_0|Runtime::DOTNETCORE_2_0|Runtime::DOTNETCORE_2_1|Runtime::NODEJS_4_3_EDGE|Runtime::GO_1_X|Runtime::RUBY_2_5|Runtime::PROVIDED|null $value
121+
* @param Runtime::*|null $value
122122
*/
123123
public function setCompatibleRuntime(?string $value): self
124124
{
@@ -151,8 +151,8 @@ public function setMaxItems(?int $value): self
151151
public function validate(): void
152152
{
153153
if (null !== $this->CompatibleRuntime) {
154-
if (!isset(Runtime::AVAILABLE_RUNTIME[$this->CompatibleRuntime])) {
155-
throw new InvalidArgument(sprintf('Invalid parameter "CompatibleRuntime" when validating the "%s". The value "%s" is not a valid "Runtime". Available values are %s.', __CLASS__, $this->CompatibleRuntime, implode(', ', array_keys(Runtime::AVAILABLE_RUNTIME))));
154+
if (!Runtime::exists($this->CompatibleRuntime)) {
155+
throw new InvalidArgument(sprintf('Invalid parameter "CompatibleRuntime" when validating the "%s". The value "%s" is not a valid "Runtime".', __CLASS__, $this->CompatibleRuntime));
156156
}
157157
}
158158

src/Input/PublishLayerVersionRequest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PublishLayerVersionRequest
3737
*
3838
* @see https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
3939
*
40-
* @var string[]
40+
* @var list<Runtime::*>
4141
*/
4242
private $CompatibleRuntimes;
4343

@@ -53,7 +53,7 @@ class PublishLayerVersionRequest
5353
* LayerName?: string,
5454
* Description?: string,
5555
* Content?: \AsyncAws\Lambda\Input\LayerVersionContentInput|array,
56-
* CompatibleRuntimes?: string[],
56+
* CompatibleRuntimes?: list<\AsyncAws\Lambda\Enum\Runtime::*>,
5757
* LicenseInfo?: string,
5858
* } $input
5959
*/
@@ -72,7 +72,7 @@ public static function create($input): self
7272
}
7373

7474
/**
75-
* @return string[]
75+
* @return list<Runtime::*>
7676
*/
7777
public function getCompatibleRuntimes(): array
7878
{
@@ -164,7 +164,7 @@ public function requestUri(): string
164164
}
165165

166166
/**
167-
* @param string[] $value
167+
* @param list<Runtime::*> $value
168168
*/
169169
public function setCompatibleRuntimes(array $value): self
170170
{
@@ -213,8 +213,8 @@ public function validate(): void
213213
$this->Content->validate();
214214

215215
foreach ($this->CompatibleRuntimes as $item) {
216-
if (!isset(Runtime::AVAILABLE_RUNTIME[$item])) {
217-
throw new InvalidArgument(sprintf('Invalid parameter "CompatibleRuntimes" when validating the "%s". The value "%s" is not a valid "Runtime". Available values are %s.', __CLASS__, $item, implode(', ', array_keys(Runtime::AVAILABLE_RUNTIME))));
216+
if (!Runtime::exists($item)) {
217+
throw new InvalidArgument(sprintf('Invalid parameter "CompatibleRuntimes" when validating the "%s". The value "%s" is not a valid "Runtime".', __CLASS__, $item));
218218
}
219219
}
220220
}

src/LambdaClient.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public function addLayerVersionPermission($input): AddLayerVersionPermissionResp
5555
*
5656
* @param array{
5757
* FunctionName: string,
58-
* InvocationType?: \AsyncAws\Lambda\Enum\InvocationType::EVENT|\AsyncAws\Lambda\Enum\InvocationType::REQUEST_RESPONSE|\AsyncAws\Lambda\Enum\InvocationType::DRY_RUN,
59-
* LogType?: \AsyncAws\Lambda\Enum\LogType::NONE|\AsyncAws\Lambda\Enum\LogType::TAIL,
58+
* InvocationType?: \AsyncAws\Lambda\Enum\InvocationType::*,
59+
* LogType?: \AsyncAws\Lambda\Enum\LogType::*,
6060
* ClientContext?: string,
6161
* Payload?: string,
6262
* Qualifier?: string,
@@ -86,7 +86,7 @@ public function invoke($input): InvocationResponse
8686
* @see https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-lambda-2015-03-31.html#listlayerversions
8787
*
8888
* @param array{
89-
* CompatibleRuntime?: \AsyncAws\Lambda\Enum\Runtime::NODEJS|\AsyncAws\Lambda\Enum\Runtime::NODEJS_4_3|\AsyncAws\Lambda\Enum\Runtime::NODEJS_6_10|\AsyncAws\Lambda\Enum\Runtime::NODEJS_8_10|\AsyncAws\Lambda\Enum\Runtime::NODEJS_10_X|\AsyncAws\Lambda\Enum\Runtime::NODEJS_12_X|\AsyncAws\Lambda\Enum\Runtime::JAVA_8|\AsyncAws\Lambda\Enum\Runtime::JAVA_11|\AsyncAws\Lambda\Enum\Runtime::PYTHON_2_7|\AsyncAws\Lambda\Enum\Runtime::PYTHON_3_6|\AsyncAws\Lambda\Enum\Runtime::PYTHON_3_7|\AsyncAws\Lambda\Enum\Runtime::PYTHON_3_8|\AsyncAws\Lambda\Enum\Runtime::DOTNETCORE_1_0|\AsyncAws\Lambda\Enum\Runtime::DOTNETCORE_2_0|\AsyncAws\Lambda\Enum\Runtime::DOTNETCORE_2_1|\AsyncAws\Lambda\Enum\Runtime::NODEJS_4_3_EDGE|\AsyncAws\Lambda\Enum\Runtime::GO_1_X|\AsyncAws\Lambda\Enum\Runtime::RUBY_2_5|\AsyncAws\Lambda\Enum\Runtime::PROVIDED,
89+
* CompatibleRuntime?: \AsyncAws\Lambda\Enum\Runtime::*,
9090
* LayerName: string,
9191
* Marker?: string,
9292
* MaxItems?: int,
@@ -118,7 +118,7 @@ public function listLayerVersions($input): ListLayerVersionsResponse
118118
* LayerName: string,
119119
* Description?: string,
120120
* Content: \AsyncAws\Lambda\Input\LayerVersionContentInput|array,
121-
* CompatibleRuntimes?: string[],
121+
* CompatibleRuntimes?: list<\AsyncAws\Lambda\Enum\Runtime::*>,
122122
* LicenseInfo?: string,
123123
* }|PublishLayerVersionRequest $input
124124
*/

src/Result/LayerVersionContentOutput.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ class LayerVersionContentOutput
1212

1313
/**
1414
* @param array{
15-
* Location: ?string,
16-
* CodeSha256: ?string,
17-
* CodeSize: ?string,
15+
* Location: null|string,
16+
* CodeSha256: null|string,
17+
* CodeSize: null|string,
1818
* } $input
1919
*/
2020
public function __construct(array $input)

src/Result/LayerVersionsListItem.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace AsyncAws\Lambda\Result;
44

5+
use AsyncAws\Lambda\Enum\Runtime;
6+
57
class LayerVersionsListItem
68
{
79
private $LayerVersionArn;
@@ -18,12 +20,12 @@ class LayerVersionsListItem
1820

1921
/**
2022
* @param array{
21-
* LayerVersionArn: ?string,
22-
* Version: ?string,
23-
* Description: ?string,
24-
* CreatedDate: ?string,
25-
* CompatibleRuntimes: ?string[],
26-
* LicenseInfo: ?string,
23+
* LayerVersionArn: null|string,
24+
* Version: null|string,
25+
* Description: null|string,
26+
* CreatedDate: null|string,
27+
* CompatibleRuntimes: null|list<\AsyncAws\Lambda\Enum\Runtime::*>,
28+
* LicenseInfo: null|string,
2729
* } $input
2830
*/
2931
public function __construct(array $input)
@@ -42,7 +44,7 @@ public static function create($input): self
4244
}
4345

4446
/**
45-
* @return string[]
47+
* @return list<Runtime::*>
4648
*/
4749
public function getCompatibleRuntimes(): array
4850
{

src/Result/PublishLayerVersionResponse.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace AsyncAws\Lambda\Result;
44

55
use AsyncAws\Core\Result;
6+
use AsyncAws\Lambda\Enum\Runtime;
67
use Symfony\Contracts\HttpClient\HttpClientInterface;
78
use Symfony\Contracts\HttpClient\ResponseInterface;
89

@@ -25,7 +26,7 @@ class PublishLayerVersionResponse extends Result
2526
private $LicenseInfo;
2627

2728
/**
28-
* @return string[]
29+
* @return list<Runtime::*>
2930
*/
3031
public function getCompatibleRuntimes(): array
3132
{

0 commit comments

Comments
 (0)