@@ -29,7 +29,7 @@ public function statusCodes(): array
2929 /**
3030 * @dataProvider statusCodes
3131 */
32- public function testStatusIsUsedVerbatim (int $ status )
32+ public function testStatusIsUsedVerbatim (int $ status ): void
3333 {
3434 $ apiProblem = new ApiProblem ($ status , 'foo ' );
3535 $ payload = $ apiProblem ->toArray ();
@@ -40,7 +40,7 @@ public function testStatusIsUsedVerbatim(int $status)
4040 /**
4141 * @requires PHP 7.0
4242 */
43- public function testErrorAsDetails ()
43+ public function testErrorAsDetails (): void
4444 {
4545 $ error = new TypeError ('error message ' , 705 );
4646 $ apiProblem = new ApiProblem (500 , $ error );
@@ -54,7 +54,7 @@ public function testErrorAsDetails()
5454 $ this ->assertEquals ('error message ' , $ payload ['detail ' ]);
5555 }
5656
57- public function testExceptionCodeIsUsedForStatus ()
57+ public function testExceptionCodeIsUsedForStatus (): void
5858 {
5959 $ exception = new \Exception ('exception message ' , 401 );
6060 $ apiProblem = new ApiProblem ('500 ' , $ exception );
@@ -63,15 +63,15 @@ public function testExceptionCodeIsUsedForStatus()
6363 $ this ->assertEquals ($ exception ->getCode (), $ payload ['status ' ]);
6464 }
6565
66- public function testDetailStringIsUsedVerbatim ()
66+ public function testDetailStringIsUsedVerbatim (): void
6767 {
6868 $ apiProblem = new ApiProblem ('500 ' , 'foo ' );
6969 $ payload = $ apiProblem ->toArray ();
7070 $ this ->assertArrayHasKey ('detail ' , $ payload );
7171 $ this ->assertEquals ('foo ' , $ payload ['detail ' ]);
7272 }
7373
74- public function testExceptionMessageIsUsedForDetail ()
74+ public function testExceptionMessageIsUsedForDetail (): void
7575 {
7676 $ exception = new \Exception ('exception message ' );
7777 $ apiProblem = new ApiProblem ('500 ' , $ exception );
@@ -80,7 +80,7 @@ public function testExceptionMessageIsUsedForDetail()
8080 $ this ->assertEquals ($ exception ->getMessage (), $ payload ['detail ' ]);
8181 }
8282
83- public function testExceptionsCanTriggerInclusionOfStackTraceInDetails ()
83+ public function testExceptionsCanTriggerInclusionOfStackTraceInDetails (): void
8484 {
8585 $ exception = new \Exception ('exception message ' );
8686 $ apiProblem = new ApiProblem ('500 ' , $ exception );
@@ -91,7 +91,7 @@ public function testExceptionsCanTriggerInclusionOfStackTraceInDetails()
9191 $ this ->assertEquals ($ exception ->getTrace (), $ payload ['trace ' ]);
9292 }
9393
94- public function testExceptionsCanTriggerInclusionOfNestedExceptions ()
94+ public function testExceptionsCanTriggerInclusionOfNestedExceptions (): void
9595 {
9696 $ exceptionChild = new \Exception ('child exception ' );
9797 $ exceptionParent = new \Exception ('parent exception ' , null , $ exceptionChild );
@@ -111,7 +111,7 @@ public function testExceptionsCanTriggerInclusionOfNestedExceptions()
111111 $ this ->assertEquals ($ expected , $ payload ['exception_stack ' ]);
112112 }
113113
114- public function testTypeUrlIsUsedVerbatim ()
114+ public function testTypeUrlIsUsedVerbatim (): void
115115 {
116116 $ apiProblem = new ApiProblem ('500 ' , 'foo ' , 'http://status.dev:8080/details.md ' );
117117 $ payload = $ apiProblem ->toArray ();
@@ -133,7 +133,7 @@ public function knownStatusCodes(): array
133133 /**
134134 * @dataProvider knownStatusCodes
135135 */
136- public function testKnownStatusResultsInKnownTitle (int $ status )
136+ public function testKnownStatusResultsInKnownTitle (int $ status ): void
137137 {
138138 $ apiProblem = new ApiProblem ($ status , 'foo ' );
139139 $ r = new ReflectionObject ($ apiProblem );
@@ -146,23 +146,23 @@ public function testKnownStatusResultsInKnownTitle(int $status)
146146 $ this ->assertEquals ($ titles [$ status ], $ payload ['title ' ]);
147147 }
148148
149- public function testUnknownStatusResultsInUnknownTitle ()
149+ public function testUnknownStatusResultsInUnknownTitle (): void
150150 {
151151 $ apiProblem = new ApiProblem (420 , 'foo ' );
152152 $ payload = $ apiProblem ->toArray ();
153153 $ this ->assertArrayHasKey ('title ' , $ payload );
154154 $ this ->assertEquals ('Unknown ' , $ payload ['title ' ]);
155155 }
156156
157- public function testProvidedTitleIsUsedVerbatim ()
157+ public function testProvidedTitleIsUsedVerbatim (): void
158158 {
159159 $ apiProblem = new ApiProblem ('500 ' , 'foo ' , 'http://status.dev:8080/details.md ' , 'some title ' );
160160 $ payload = $ apiProblem ->toArray ();
161161 $ this ->assertArrayHasKey ('title ' , $ payload );
162162 $ this ->assertEquals ('some title ' , $ payload ['title ' ]);
163163 }
164164
165- public function testCanPassArbitraryDetailsToConstructor ()
165+ public function testCanPassArbitraryDetailsToConstructor (): void
166166 {
167167 $ problem = new ApiProblem (
168168 400 ,
@@ -174,7 +174,7 @@ public function testCanPassArbitraryDetailsToConstructor()
174174 $ this ->assertEquals ('bar ' , $ problem ->foo );
175175 }
176176
177- public function testArraySerializationIncludesArbitraryDetails ()
177+ public function testArraySerializationIncludesArbitraryDetails (): void
178178 {
179179 $ problem = new ApiProblem (
180180 400 ,
@@ -188,7 +188,7 @@ public function testArraySerializationIncludesArbitraryDetails()
188188 $ this ->assertEquals ('bar ' , $ array ['foo ' ]);
189189 }
190190
191- public function testArbitraryDetailsShouldNotOverwriteRequiredFieldsInArraySerialization ()
191+ public function testArbitraryDetailsShouldNotOverwriteRequiredFieldsInArraySerialization (): void
192192 {
193193 $ problem = new ApiProblem (
194194 400 ,
@@ -202,7 +202,7 @@ public function testArbitraryDetailsShouldNotOverwriteRequiredFieldsInArraySeria
202202 $ this ->assertEquals ('Invalid entity ' , $ array ['title ' ]);
203203 }
204204
205- public function testUsesTitleFromExceptionWhenProvided ()
205+ public function testUsesTitleFromExceptionWhenProvided (): void
206206 {
207207 $ exception = new Exception \DomainException ('exception message ' , 401 );
208208 $ exception ->setTitle ('problem title ' );
@@ -212,7 +212,7 @@ public function testUsesTitleFromExceptionWhenProvided()
212212 $ this ->assertEquals ($ exception ->getTitle (), $ payload ['title ' ]);
213213 }
214214
215- public function testUsesTypeFromExceptionWhenProvided ()
215+ public function testUsesTypeFromExceptionWhenProvided (): void
216216 {
217217 $ exception = new Exception \DomainException ('exception message ' , 401 );
218218 $ exception ->setType ('http://example.com/api/help/401 ' );
@@ -222,7 +222,7 @@ public function testUsesTypeFromExceptionWhenProvided()
222222 $ this ->assertEquals ($ exception ->getType (), $ payload ['type ' ]);
223223 }
224224
225- public function testUsesAdditionalDetailsFromExceptionWhenProvided ()
225+ public function testUsesAdditionalDetailsFromExceptionWhenProvided (): void
226226 {
227227 $ exception = new Exception \DomainException ('exception message ' , 401 );
228228 $ exception ->setAdditionalDetails (['foo ' => 'bar ' ]);
@@ -248,7 +248,7 @@ public function invalidStatusCodes(): array
248248 * @dataProvider invalidStatusCodes
249249 * @group api-tools-118
250250 */
251- public function testInvalidHttpStatusCodesAreCastTo500 (int $ code )
251+ public function testInvalidHttpStatusCodesAreCastTo500 (int $ code ): void
252252 {
253253 $ e = new \Exception ('Testing ' , $ code );
254254 $ problem = new ApiProblem ($ code , $ e );
0 commit comments