1111namespace Rebilly \OpenAPI \PhpUnit ;
1212
1313use PHPUnit \Framework \Assert ;
14- use Psr \Http \Message \RequestInterface as Request ;
15- use Psr \Http \Message \ResponseInterface as Response ;
16- use Psr \Http \Message \StreamInterface as Stream ;
17- use Psr \Http \Message \UriInterface as Uri ;
18- use Rebilly \OpenAPI \Schema as Spec ;
14+ use Psr \Http \Message \RequestInterface ;
15+ use Psr \Http \Message \ResponseInterface ;
16+ use Psr \Http \Message \StreamInterface ;
17+ use Psr \Http \Message \UriInterface ;
18+ use Rebilly \OpenAPI \Schema ;
1919
2020/**
2121 * Asserts data against OpenAPI specification.
@@ -33,12 +33,12 @@ trait Asserts
3333 * - Assert headers declared by parameters (header)
3434 * - Assert body declared by parameters (body)
3535 *
36- * @param Spec $spec
36+ * @param Schema $spec
3737 * @param string $template
38- * @param Request $request
38+ * @param RequestInterface $request
3939 * @param string $msg
4040 */
41- final protected static function assertRequest (Spec $ spec , $ template , Request $ request , $ msg = '' )
41+ final protected static function assertRequest (Schema $ spec , $ template , RequestInterface $ request , $ msg = '' )
4242 {
4343 self ::assertMethodAllowed ($ spec , $ template , $ request ->getMethod (), $ msg );
4444 self ::assertUri ($ spec , $ template , $ request ->getMethod (), $ request ->getUri (), $ msg );
@@ -56,13 +56,13 @@ final protected static function assertRequest(Spec $spec, $template, Request $re
5656 * - Assert headers
5757 * - Assert body
5858 *
59- * @param Spec $spec
59+ * @param Schema $spec
6060 * @param string $template
6161 * @param string $method
62- * @param Response $response
62+ * @param ResponseInterface $response
6363 * @param string $msg
6464 */
65- final protected static function assertResponse (Spec $ spec , $ template , $ method , Response $ response , $ msg = '' )
65+ final protected static function assertResponse (Schema $ spec , $ template , $ method , ResponseInterface $ response , $ msg = '' )
6666 {
6767 self ::assertResponseDefined ($ spec , $ template , $ method , $ response ->getStatusCode (), $ msg );
6868 self ::assertResponseHeaders (
@@ -94,13 +94,13 @@ final protected static function assertResponse(Spec $spec, $template, $method, R
9494 * - Assert URI path matches defined template and path parameters
9595 * - Assert URI path matches defined query parameters
9696 *
97- * @param Spec $spec
97+ * @param Schema $spec
9898 * @param string $template
9999 * @param string $method
100- * @param Uri $uri
100+ * @param UriInterface $uri
101101 * @param string $msg
102102 */
103- final protected static function assertUri (Spec $ spec , $ template , $ method , Uri $ uri , $ msg = '' )
103+ final protected static function assertUri (Schema $ spec , $ template , $ method , UriInterface $ uri , $ msg = '' )
104104 {
105105 Assert::assertThat (
106106 $ uri ,
@@ -119,12 +119,12 @@ final protected static function assertUri(Spec $spec, $template, $method, Uri $u
119119 /**
120120 * Assert the endpoint supports given operation.
121121 *
122- * @param Spec $spec
122+ * @param Schema $spec
123123 * @param string $template
124124 * @param string $method
125125 * @param string $msg
126126 */
127- final protected static function assertMethodAllowed (Spec $ spec , $ template , $ method , $ msg = '' )
127+ final protected static function assertMethodAllowed (Schema $ spec , $ template , $ method , $ msg = '' )
128128 {
129129 Assert::assertThat (
130130 $ method ,
@@ -136,13 +136,13 @@ final protected static function assertMethodAllowed(Spec $spec, $template, $meth
136136 /**
137137 * Assert the response status code defined.
138138 *
139- * @param Spec $spec
139+ * @param Schema $spec
140140 * @param string $template
141141 * @param string $method
142142 * @param string $status
143143 * @param string $msg
144144 */
145- final protected static function assertResponseDefined (Spec $ spec , $ template , $ method , $ status , $ msg = '' )
145+ final protected static function assertResponseDefined (Schema $ spec , $ template , $ method , $ status , $ msg = '' )
146146 {
147147 Assert::assertTrue (
148148 in_array ((int ) $ status , $ spec ->getResponseCodes ($ template , strtolower ($ method )), true ),
@@ -153,13 +153,13 @@ final protected static function assertResponseDefined(Spec $spec, $template, $me
153153 /**
154154 * Assert the endpoint supports given operation.
155155 *
156- * @param Spec $spec
156+ * @param Schema $spec
157157 * @param string $template
158158 * @param string $method
159159 * @param string $contentType
160160 * @param string $msg
161161 */
162- final protected static function assertRequestContentType (Spec $ spec , $ template , $ method , $ contentType , $ msg = '' )
162+ final protected static function assertRequestContentType (Schema $ spec , $ template , $ method , $ contentType , $ msg = '' )
163163 {
164164 Assert::assertThat (
165165 $ contentType ,
@@ -171,13 +171,13 @@ final protected static function assertRequestContentType(Spec $spec, $template,
171171 /**
172172 * Assert the endpoint supports given operation.
173173 *
174- * @param Spec $spec
174+ * @param Schema $spec
175175 * @param string $template
176176 * @param string $method
177177 * @param string $contentType
178178 * @param string $msg
179179 */
180- final protected static function assertResponseContentType (Spec $ spec , $ template , $ method , $ contentType , $ msg = '' )
180+ final protected static function assertResponseContentType (Schema $ spec , $ template , $ method , $ contentType , $ msg = '' )
181181 {
182182 Assert::assertThat (
183183 $ contentType ,
@@ -187,13 +187,13 @@ final protected static function assertResponseContentType(Spec $spec, $template,
187187 }
188188
189189 /**
190- * @param Spec $spec
190+ * @param Schema $spec
191191 * @param string $template
192192 * @param string $method
193193 * @param array $headers
194194 * @param string $msg
195195 */
196- final protected static function assertRequestHeaders (Spec $ spec , $ template , $ method , array $ headers , $ msg = '' )
196+ final protected static function assertRequestHeaders (Schema $ spec , $ template , $ method , array $ headers , $ msg = '' )
197197 {
198198 Assert::assertThat (
199199 $ headers ,
@@ -213,14 +213,14 @@ final protected static function assertRequestHeaders(Spec $spec, $template, $met
213213 }
214214
215215 /**
216- * @param Spec $spec
216+ * @param Schema $spec
217217 * @param string $template
218218 * @param string $method
219219 * @param string $status
220220 * @param array $headers
221221 * @param string $msg
222222 */
223- final protected static function assertResponseHeaders (Spec $ spec , $ template , $ method , $ status , array $ headers , $ msg = '' )
223+ final protected static function assertResponseHeaders (Schema $ spec , $ template , $ method , $ status , array $ headers , $ msg = '' )
224224 {
225225 Assert::assertThat (
226226 $ headers ,
@@ -254,13 +254,13 @@ final protected static function assertResponseHeaders(Spec $spec, $template, $me
254254 }
255255
256256 /**
257- * @param Spec $spec
257+ * @param Schema $spec
258258 * @param string $template
259259 * @param string $method
260- * @param Stream |null $body
260+ * @param StreamInterface |null $body
261261 * @param string $msg
262262 */
263- final protected static function assertRequestBody (Spec $ spec , $ template , $ method , Stream $ body = null , $ msg = '' )
263+ final protected static function assertRequestBody (Schema $ spec , $ template , $ method , StreamInterface $ body = null , $ msg = '' )
264264 {
265265 $ schema = $ spec ->getRequestBodySchema ($ template , strtolower ($ method ));
266266
@@ -276,14 +276,14 @@ final protected static function assertRequestBody(Spec $spec, $template, $method
276276 }
277277
278278 /**
279- * @param Spec $spec
279+ * @param Schema $spec
280280 * @param string $template
281281 * @param string $method
282282 * @param string $status
283- * @param Stream |null $body
283+ * @param StreamInterface |null $body
284284 * @param string $msg
285285 */
286- final protected static function assertResponseBody (Spec $ spec , $ template , $ method , $ status , Stream $ body = null , $ msg = '' )
286+ final protected static function assertResponseBody (Schema $ spec , $ template , $ method , $ status , StreamInterface $ body = null , $ msg = '' )
287287 {
288288 $ schema = $ spec ->getResponseBodySchema ($ template , strtolower ($ method ), $ status );
289289
@@ -299,12 +299,12 @@ final protected static function assertResponseBody(Spec $spec, $template, $metho
299299 }
300300
301301 /**
302- * @param Spec $spec
302+ * @param Schema $spec
303303 * @param string $class
304304 * @param mixed $actual
305305 * @param string $msg
306306 */
307- final protected static function assertDefinitionSchema (Spec $ spec , $ class , $ actual , $ msg = '' )
307+ final protected static function assertDefinitionSchema (Schema $ spec , $ class , $ actual , $ msg = '' )
308308 {
309309 Assert::assertThat (
310310 $ actual ,
0 commit comments