@@ -41,7 +41,7 @@ final class PublishLayerVersionRequest extends Input
41
41
*
42
42
* @see https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
43
43
*
44
- * @var list<Runtime::*>
44
+ * @var null| list<Runtime::*>
45
45
*/
46
46
private $ CompatibleRuntimes ;
47
47
@@ -67,7 +67,7 @@ public function __construct(array $input = [])
67
67
$ this ->LayerName = $ input ['LayerName ' ] ?? null ;
68
68
$ this ->Description = $ input ['Description ' ] ?? null ;
69
69
$ this ->Content = isset ($ input ['Content ' ]) ? LayerVersionContentInput::create ($ input ['Content ' ]) : null ;
70
- $ this ->CompatibleRuntimes = $ input ['CompatibleRuntimes ' ] ?? [] ;
70
+ $ this ->CompatibleRuntimes = $ input ['CompatibleRuntimes ' ] ?? null ;
71
71
$ this ->LicenseInfo = $ input ['LicenseInfo ' ] ?? null ;
72
72
parent ::__construct ($ input );
73
73
}
@@ -82,7 +82,7 @@ public static function create($input): self
82
82
*/
83
83
public function getCompatibleRuntimes (): array
84
84
{
85
- return $ this ->CompatibleRuntimes ;
85
+ return $ this ->CompatibleRuntimes ?? [] ;
86
86
}
87
87
88
88
public function getContent (): ?LayerVersionContentInput
@@ -181,16 +181,17 @@ private function requestBody(): array
181
181
throw new InvalidArgument (sprintf ('Missing parameter "Content" for "%s". The value cannot be null. ' , __CLASS__ ));
182
182
}
183
183
$ payload ['Content ' ] = $ v ->requestBody ();
184
-
185
- $ index = -1 ;
186
- foreach ($ this ->CompatibleRuntimes as $ listValue ) {
187
- ++$ index ;
188
- if (!Runtime::exists ($ listValue )) {
189
- throw new InvalidArgument (sprintf ('Invalid parameter "CompatibleRuntimes" for "%s". The value "%s" is not a valid "Runtime". ' , __CLASS__ , $ listValue ));
184
+ if (null !== $ v = $ this ->CompatibleRuntimes ) {
185
+ $ index = -1 ;
186
+ $ payload ['CompatibleRuntimes ' ] = [];
187
+ foreach ($ v as $ listValue ) {
188
+ ++$ index ;
189
+ if (!Runtime::exists ($ listValue )) {
190
+ throw new InvalidArgument (sprintf ('Invalid parameter "CompatibleRuntimes" for "%s". The value "%s" is not a valid "Runtime". ' , __CLASS__ , $ listValue ));
191
+ }
192
+ $ payload ['CompatibleRuntimes ' ][$ index ] = $ listValue ;
190
193
}
191
- $ payload ['CompatibleRuntimes ' ][$ index ] = $ listValue ;
192
194
}
193
-
194
195
if (null !== $ v = $ this ->LicenseInfo ) {
195
196
$ payload ['LicenseInfo ' ] = $ v ;
196
197
}
0 commit comments