diff --git a/src/PSR7/SpecFinder.php b/src/PSR7/SpecFinder.php index c668b058..a3ad854b 100644 --- a/src/PSR7/SpecFinder.php +++ b/src/PSR7/SpecFinder.php @@ -26,6 +26,7 @@ use function json_decode; use function json_encode; use function property_exists; +use function substr; final class SpecFinder { @@ -211,10 +212,10 @@ public function findResponseSpec($addr): ResponseSpec $response = $operation->responses->getResponse((string) $addr->responseCode()); - if (! $response){ - $response = $operation->responses->getResponse(substr((string)$addr->responseCode(),0,1) . 'XX'); + if (! $response) { + $response = $operation->responses->getResponse(substr((string) $addr->responseCode(), 0, 1) . 'XX'); } - + if (! $response) { $response = $operation->responses->getResponse('default'); } diff --git a/tests/PSR7/SpecFinderTest.php b/tests/PSR7/SpecFinderTest.php index d9f6c785..2a5501b7 100644 --- a/tests/PSR7/SpecFinderTest.php +++ b/tests/PSR7/SpecFinderTest.php @@ -163,8 +163,8 @@ public function testResponseStatusCodesWithWildcards(): void type: string YAML; - $schema = (new ValidatorBuilder())->fromYaml($yaml)->getServerRequestValidator()->getSchema(); - $specFinder = new SpecFinder($schema); + $schema = (new ValidatorBuilder())->fromYaml($yaml)->getServerRequestValidator()->getSchema(); + $specFinder = new SpecFinder($schema); $responseSpec = $specFinder->findResponseSpec( new ResponseAddress('/products.find', 'get', 404) );