@@ -31,12 +31,12 @@ protected function tearDown(): void
3131 ob_end_clean ();
3232 }
3333
34- public function test basic behavior ()
34+ public function test basic behavior (): void
3535 {
3636 $ this ->givenAnEvent (['Hello ' => 'world! ' ]);
3737
3838 $ output = $ this ->lambda ->processNextEvent (new class implements Handler {
39- public function handle ($ event , Context $ context )
39+ public function handle ($ event , Context $ context ): array
4040 {
4141 return ['hello ' => 'world ' ];
4242 }
@@ -46,12 +46,12 @@ public function handle($event, Context $context)
4646 $ this ->assertInvocationResult (['hello ' => 'world ' ]);
4747 }
4848
49- public function test handler receives context ()
49+ public function test handler receives context (): void
5050 {
5151 $ this ->givenAnEvent (['Hello ' => 'world! ' ]);
5252
5353 $ this ->lambda ->processNextEvent (new class implements Handler {
54- public function handle ($ event , Context $ context )
54+ public function handle ($ event , Context $ context ): array
5555 {
5656 return ['hello ' => 'world ' , 'received-function-arn ' => $ context ->getInvokedFunctionArn ()];
5757 }
@@ -63,7 +63,7 @@ public function handle($event, Context $context)
6363 ]);
6464 }
6565
66- public function test exceptions in the handler result in an invocation error ()
66+ public function test exceptions in the handler result in an invocation error (): void
6767 {
6868 $ this ->givenAnEvent (['Hello ' => 'world! ' ]);
6969
@@ -79,7 +79,7 @@ public function handle($event, Context $context)
7979 $ this ->assertErrorInLogs ('RuntimeException ' , 'This is an exception ' );
8080 }
8181
82- public function test nested exceptions in the handler result in an invocation error ()
82+ public function test nested exceptions in the handler result in an invocation error (): void
8383 {
8484 $ this ->givenAnEvent (['Hello ' => 'world! ' ]);
8585
@@ -98,7 +98,7 @@ public function handle($event, Context $context)
9898 ]);
9999 }
100100
101- public function test an error is thrown if the runtime API returns a wrong response ()
101+ public function test an error is thrown if the runtime API returns a wrong response (): void
102102 {
103103 $ this ->expectExceptionMessage ('Failed to fetch next Lambda invocation: The requested URL returned error: 404 ' );
104104 Server::enqueue ([
@@ -118,7 +118,7 @@ public function handle($event, Context $context)
118118 });
119119 }
120120
121- public function test an error is thrown if the invocation id is missing ()
121+ public function test an error is thrown if the invocation id is missing (): void
122122 {
123123 $ this ->expectExceptionMessage ('Failed to determine the Lambda invocation ID ' );
124124 Server::enqueue ([
@@ -136,7 +136,7 @@ public function handle($event, Context $context)
136136 });
137137 }
138138
139- public function test an error is thrown if the invocation body is empty ()
139+ public function test an error is thrown if the invocation body is empty (): void
140140 {
141141 $ this ->expectExceptionMessage ('Empty Lambda runtime API response ' );
142142 Server::enqueue ([
@@ -155,7 +155,7 @@ public function handle($event, Context $context)
155155 });
156156 }
157157
158- public function test a wrong response from the runtime API turns the invocation into an error ()
158+ public function test a wrong response from the runtime API turns the invocation into an error (): void
159159 {
160160 Server::enqueue ([
161161 new Response ( // lambda event
@@ -193,12 +193,12 @@ public function handle($event, Context $context)
193193 $ this ->assertErrorInLogs ('Exception ' , 'Error while calling the Lambda runtime API: The requested URL returned error: 400 ' );
194194 }
195195
196- public function test function results that cannot be encoded are reported as invocation errors ()
196+ public function test function results that cannot be encoded are reported as invocation errors (): void
197197 {
198198 $ this ->givenAnEvent (['hello ' => 'world! ' ]);
199199
200200 $ this ->lambda ->processNextEvent (new class implements Handler {
201- public function handle ($ event , Context $ context )
201+ public function handle ($ event , Context $ context ): string
202202 {
203203 return "\xB1\x31" ;
204204 }
@@ -213,7 +213,7 @@ public function handle($event, Context $context)
213213 $ this ->assertErrorInLogs ('Exception ' , $ message );
214214 }
215215
216- public function test generic event handler ()
216+ public function test generic event handler (): void
217217 {
218218 $ handler = new class implements Handler {
219219 public function handle ($ event , Context $ context )
@@ -244,7 +244,7 @@ private function givenAnEvent($event): void
244244 ]);
245245 }
246246
247- private function assertInvocationResult ($ result )
247+ private function assertInvocationResult ($ result ): void
248248 {
249249 $ requests = Server::received ();
250250 $ this ->assertCount (2 , $ requests );
@@ -257,7 +257,7 @@ private function assertInvocationResult($result)
257257 $ this ->assertEquals ($ result , json_decode ($ eventResponse ->getBody ()->__toString (), true ));
258258 }
259259
260- private function assertInvocationErrorResult (string $ errorClass , string $ errorMessage )
260+ private function assertInvocationErrorResult (string $ errorClass , string $ errorMessage ): void
261261 {
262262 $ requests = Server::received ();
263263 $ this ->assertCount (2 , $ requests );
@@ -304,7 +304,7 @@ private function assertErrorInLogs(string $errorClass, string $errorMessage): vo
304304 $ this ->assertIsArray ($ invocationResult ['stack ' ]);
305305 }
306306
307- private function assertPreviousErrorsInLogs (array $ previousErrors )
307+ private function assertPreviousErrorsInLogs (array $ previousErrors ): void
308308 {
309309 // Decode the logs from stdout
310310 $ stdout = $ this ->getActualOutput ();
0 commit comments