@@ -41,7 +41,7 @@ final class PublishLayerVersionRequest extends Input
4141 *
4242 * @see https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html
4343 *
44- * @var list<Runtime::*>
44+ * @var null| list<Runtime::*>
4545 */
4646 private $ CompatibleRuntimes ;
4747
@@ -67,7 +67,7 @@ public function __construct(array $input = [])
6767 $ this ->LayerName = $ input ['LayerName ' ] ?? null ;
6868 $ this ->Description = $ input ['Description ' ] ?? null ;
6969 $ this ->Content = isset ($ input ['Content ' ]) ? LayerVersionContentInput::create ($ input ['Content ' ]) : null ;
70- $ this ->CompatibleRuntimes = $ input ['CompatibleRuntimes ' ] ?? [] ;
70+ $ this ->CompatibleRuntimes = $ input ['CompatibleRuntimes ' ] ?? null ;
7171 $ this ->LicenseInfo = $ input ['LicenseInfo ' ] ?? null ;
7272 parent ::__construct ($ input );
7373 }
@@ -82,7 +82,7 @@ public static function create($input): self
8282 */
8383 public function getCompatibleRuntimes (): array
8484 {
85- return $ this ->CompatibleRuntimes ;
85+ return $ this ->CompatibleRuntimes ?? [] ;
8686 }
8787
8888 public function getContent (): ?LayerVersionContentInput
@@ -181,16 +181,17 @@ private function requestBody(): array
181181 throw new InvalidArgument (sprintf ('Missing parameter "Content" for "%s". The value cannot be null. ' , __CLASS__ ));
182182 }
183183 $ 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 ;
190193 }
191- $ payload ['CompatibleRuntimes ' ][$ index ] = $ listValue ;
192194 }
193-
194195 if (null !== $ v = $ this ->LicenseInfo ) {
195196 $ payload ['LicenseInfo ' ] = $ v ;
196197 }
0 commit comments