@@ -32,12 +32,12 @@ protected function tearDown(): void
3232 ob_end_clean ();
3333 }
3434
35- public function test basic behavior ()
35+ public function test basic behavior (): void
3636 {
3737 $ this ->givenAnEvent (['Hello ' => 'world! ' ]);
3838
3939 $ output = $ this ->lambda ->processNextEvent (new class implements Handler {
40- public function handle ($ event , Context $ context )
40+ public function handle ($ event , Context $ context ): array
4141 {
4242 return ['hello ' => 'world ' ];
4343 }
@@ -47,12 +47,12 @@ public function handle($event, Context $context)
4747 $ this ->assertInvocationResult (['hello ' => 'world ' ]);
4848 }
4949
50- public function test handler receives context ()
50+ public function test handler receives context (): void
5151 {
5252 $ this ->givenAnEvent (['Hello ' => 'world! ' ]);
5353
5454 $ this ->lambda ->processNextEvent (new class implements Handler {
55- public function handle ($ event , Context $ context )
55+ public function handle ($ event , Context $ context ): array
5656 {
5757 return ['hello ' => 'world ' , 'received-function-arn ' => $ context ->getInvokedFunctionArn ()];
5858 }
@@ -64,7 +64,7 @@ public function handle($event, Context $context)
6464 ]);
6565 }
6666
67- public function test exceptions in the handler result in an invocation error ()
67+ public function test exceptions in the handler result in an invocation error (): void
6868 {
6969 $ this ->givenAnEvent (['Hello ' => 'world! ' ]);
7070
@@ -80,7 +80,7 @@ public function handle($event, Context $context)
8080 $ this ->assertErrorInLogs ('RuntimeException ' , 'This is an exception ' );
8181 }
8282
83- public function test nested exceptions in the handler result in an invocation error ()
83+ public function test nested exceptions in the handler result in an invocation error (): void
8484 {
8585 $ this ->givenAnEvent (['Hello ' => 'world! ' ]);
8686
@@ -99,7 +99,7 @@ public function handle($event, Context $context)
9999 ]);
100100 }
101101
102- public function test an error is thrown if the runtime API returns a wrong response ()
102+ public function test an error is thrown if the runtime API returns a wrong response (): void
103103 {
104104 $ this ->expectExceptionMessage ('Failed to fetch next Lambda invocation: The requested URL returned error: 404 ' );
105105 Server::enqueue ([
@@ -119,7 +119,7 @@ public function handle($event, Context $context)
119119 });
120120 }
121121
122- public function test an error is thrown if the invocation id is missing ()
122+ public function test an error is thrown if the invocation id is missing (): void
123123 {
124124 $ this ->expectExceptionMessage ('Failed to determine the Lambda invocation ID ' );
125125 Server::enqueue ([
@@ -137,7 +137,7 @@ public function handle($event, Context $context)
137137 });
138138 }
139139
140- public function test an error is thrown if the invocation body is empty ()
140+ public function test an error is thrown if the invocation body is empty (): void
141141 {
142142 $ this ->expectExceptionMessage ('Empty Lambda runtime API response ' );
143143 Server::enqueue ([
@@ -156,7 +156,7 @@ public function handle($event, Context $context)
156156 });
157157 }
158158
159- public function test a wrong response from the runtime API turns the invocation into an error ()
159+ public function test a wrong response from the runtime API turns the invocation into an error (): void
160160 {
161161 Server::enqueue ([
162162 new Response ( // lambda event
@@ -194,12 +194,12 @@ public function handle($event, Context $context)
194194 $ this ->assertErrorInLogs ('Exception ' , 'Error while calling the Lambda runtime API: The requested URL returned error: 400 ' );
195195 }
196196
197- public function test function results that cannot be encoded are reported as invocation errors ()
197+ public function test function results that cannot be encoded are reported as invocation errors (): void
198198 {
199199 $ this ->givenAnEvent (['hello ' => 'world! ' ]);
200200
201201 $ this ->lambda ->processNextEvent (new class implements Handler {
202- public function handle ($ event , Context $ context )
202+ public function handle ($ event , Context $ context ): string
203203 {
204204 return "\xB1\x31" ;
205205 }
@@ -214,7 +214,7 @@ public function handle($event, Context $context)
214214 $ this ->assertErrorInLogs ('Exception ' , $ message );
215215 }
216216
217- public function test generic event handler ()
217+ public function test generic event handler (): void
218218 {
219219 $ handler = new class implements Handler {
220220 public function handle ($ event , Context $ context )
@@ -245,7 +245,7 @@ private function givenAnEvent($event): void
245245 ]);
246246 }
247247
248- private function assertInvocationResult ($ result )
248+ private function assertInvocationResult ($ result ): void
249249 {
250250 $ requests = Server::received ();
251251 $ this ->assertCount (2 , $ requests );
@@ -258,7 +258,7 @@ private function assertInvocationResult($result)
258258 $ this ->assertEquals ($ result , json_decode ($ eventResponse ->getBody ()->__toString (), true ));
259259 }
260260
261- private function assertInvocationErrorResult (string $ errorClass , string $ errorMessage )
261+ private function assertInvocationErrorResult (string $ errorClass , string $ errorMessage ): void
262262 {
263263 $ requests = Server::received ();
264264 $ this ->assertCount (2 , $ requests );
@@ -305,7 +305,7 @@ private function assertErrorInLogs(string $errorClass, string $errorMessage): vo
305305 $ this ->assertIsArray ($ invocationResult ['stack ' ]);
306306 }
307307
308- private function assertPreviousErrorsInLogs (array $ previousErrors )
308+ private function assertPreviousErrorsInLogs (array $ previousErrors ): void
309309 {
310310 // Decode the logs from stdout
311311 $ stdout = $ this ->getActualOutput ();
0 commit comments