@@ -55,7 +55,7 @@ |
||
| 55 | 55 | |
| 56 | 56 | public function lookup(string $methodName): ?ApiMethodInterface |
| 57 | 57 | { |
| 58 | - return $this->methods[$methodName] ?? null; |
|
| 58 | + return $this->methods[ $methodName ] ?? null; |
|
| 59 | 59 | } |
| 60 | 60 | }; |
| 61 | 61 | |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | string $message, |
| 23 | 23 | int $code, |
| 24 | 24 | Throwable $previous = null, |
| 25 | - array $context = [] |
|
| 25 | + array $context = [ ] |
|
| 26 | 26 | ) { |
| 27 | 27 | parent::__construct($message, $code, $previous); |
| 28 | 28 | |
@@ -117,7 +117,7 @@ |
||
| 117 | 117 | private function log( |
| 118 | 118 | Throwable $e, |
| 119 | 119 | UuidInterface $uuid, |
| 120 | - array $context = [] |
|
| 120 | + array $context = [ ] |
|
| 121 | 121 | ): void { |
| 122 | 122 | if ($this->logger !== null) { |
| 123 | 123 | $this->logger->error( |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | $parameter = new stdClass(); |
| 76 | 76 | $decodedInput = new stdClass(); |
| 77 | 77 | $decodedInput->parameter = $parameter; |
| 78 | - $responseData = ['some-response']; |
|
| 79 | - $processedResponse = ['some-processed-response']; |
|
| 78 | + $responseData = [ 'some-response' ]; |
|
| 79 | + $processedResponse = [ 'some-processed-response' ]; |
|
| 80 | 80 | |
| 81 | 81 | $this->requestValidator->shouldReceive('validate') |
| 82 | 82 | ->with($request) |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $errorMessage = 'some-error'; |
| 115 | 115 | $errorCode = 666; |
| 116 | - $processedResponse = ['some-processed-response']; |
|
| 116 | + $processedResponse = [ 'some-processed-response' ]; |
|
| 117 | 117 | $uuidValue = 'some-uuid'; |
| 118 | 118 | |
| 119 | 119 | $error = new class($errorMessage, $errorCode) extends ApiMethodException {}; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | $errorMessage = 'some-error'; |
| 167 | 167 | $errorCode = 666; |
| 168 | - $processedResponse = ['some-processed-response']; |
|
| 168 | + $processedResponse = [ 'some-processed-response' ]; |
|
| 169 | 169 | $uuidValue = 'some-uuid'; |
| 170 | 170 | |
| 171 | 171 | $error = new class($errorMessage, $errorCode) extends ApiException {}; |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $errorMessage = 'some-error'; |
| 265 | 265 | $errorCode = 666; |
| 266 | 266 | $uuidValue = 'some-uuid'; |
| 267 | - $context = ['some' => 'context']; |
|
| 267 | + $context = [ 'some' => 'context' ]; |
|
| 268 | 268 | |
| 269 | 269 | $error = new ResponseMalformedException($errorMessage, $errorCode, null, $context); |
| 270 | 270 | |
@@ -322,8 +322,8 @@ discard block |
||
| 322 | 322 | $parameter = new stdClass(); |
| 323 | 323 | $decodedInput = new stdClass(); |
| 324 | 324 | $decodedInput->parameter = $parameter; |
| 325 | - $responseData = ['some-response']; |
|
| 326 | - $processedResponse = ['some-processed-response']; |
|
| 325 | + $responseData = [ 'some-response' ]; |
|
| 326 | + $processedResponse = [ 'some-processed-response' ]; |
|
| 327 | 327 | |
| 328 | 328 | $this->requestValidator->shouldReceive('validate') |
| 329 | 329 | ->with($request) |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | class ResponseMalformedExceptionTest extends MockeryTestCase |
| 10 | 10 | { |
| 11 | 11 | /** @var array<string, string> */ |
| 12 | - private array $context = ['some' => 'context']; |
|
| 12 | + private array $context = [ 'some' => 'context' ]; |
|
| 13 | 13 | |
| 14 | 14 | private ResponseMalformedException $subject; |
| 15 | 15 | |
@@ -47,10 +47,10 @@ |
||
| 47 | 47 | |
| 48 | 48 | public function testBuildResponseReturnsResponse(): void |
| 49 | 49 | { |
| 50 | - $data = ['some-data']; |
|
| 50 | + $data = [ 'some-data' ]; |
|
| 51 | 51 | |
| 52 | 52 | $this->assertSame( |
| 53 | - ['data' => $data], |
|
| 53 | + [ 'data' => $data ], |
|
| 54 | 54 | $this->subject->buildResponse($data) |
| 55 | 55 | ); |
| 56 | 56 | } |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | public function testValidateInputThrowsExceptionIfInputDoesNotValidate(): void |
| 32 | 32 | { |
| 33 | - $parameter = ['test' => 'param']; |
|
| 34 | - $schemaParameter = ['schema' => 'param']; |
|
| 35 | - $input = (object) ['parameter' => $parameter]; |
|
| 36 | - $content = (object) ['properties' => (object) ['parameter' => $schemaParameter]]; |
|
| 33 | + $parameter = [ 'test' => 'param' ]; |
|
| 34 | + $schemaParameter = [ 'schema' => 'param' ]; |
|
| 35 | + $input = (object) [ 'parameter' => $parameter ]; |
|
| 36 | + $content = (object) [ 'properties' => (object) [ 'parameter' => $schemaParameter ] ]; |
|
| 37 | 37 | $validationResult = 666; |
| 38 | 38 | |
| 39 | 39 | $this->expectException(RequestMalformedException::class); |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | public function testValidateInputValidates(): void |
| 60 | 60 | { |
| 61 | - $parameter = ['test' => 'param']; |
|
| 62 | - $schemaParameter = ['schema' => 'param']; |
|
| 63 | - $input = (object) ['parameter' => $parameter]; |
|
| 64 | - $content = (object) ['properties' => (object) ['parameter' => $schemaParameter]]; |
|
| 61 | + $parameter = [ 'test' => 'param' ]; |
|
| 62 | + $schemaParameter = [ 'schema' => 'param' ]; |
|
| 63 | + $input = (object) [ 'parameter' => $parameter ]; |
|
| 64 | + $content = (object) [ 'properties' => (object) [ 'parameter' => $schemaParameter ] ]; |
|
| 65 | 65 | |
| 66 | 66 | $this->schemaValidator->shouldReceive('validate') |
| 67 | 67 | ->with( |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | public function testValidateOutputThrowsExceptionIfOutputDoesNotValidate(): void |
| 83 | 83 | { |
| 84 | - $output = (object) ['test' => 'param']; |
|
| 85 | - $schemaParameter = ['schema' => 'param']; |
|
| 86 | - $content = (object) ['properties' => (object) ['response' => $schemaParameter]]; |
|
| 87 | - $errors = ['some' => 'error']; |
|
| 84 | + $output = (object) [ 'test' => 'param' ]; |
|
| 85 | + $schemaParameter = [ 'schema' => 'param' ]; |
|
| 86 | + $content = (object) [ 'properties' => (object) [ 'response' => $schemaParameter ] ]; |
|
| 87 | + $errors = [ 'some' => 'error' ]; |
|
| 88 | 88 | $validationResult = 666; |
| 89 | 89 | |
| 90 | 90 | $this->expectException(ResponseMalformedException::class); |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | public function testValidateOutputValidates(): void |
| 115 | 115 | { |
| 116 | - $output = (object) ['test' => 'param']; |
|
| 117 | - $schemaParameter = ['schema' => 'param']; |
|
| 118 | - $content = (object) ['properties' => (object) ['response' => $schemaParameter]]; |
|
| 116 | + $output = (object) [ 'test' => 'param' ]; |
|
| 117 | + $schemaParameter = [ 'schema' => 'param' ]; |
|
| 118 | + $content = (object) [ 'properties' => (object) [ 'response' => $schemaParameter ] ]; |
|
| 119 | 119 | |
| 120 | 120 | $this->schemaValidator->shouldReceive('validate') |
| 121 | 121 | ->with( |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | public function testLoadReturnsData(): void |
| 70 | 70 | { |
| 71 | 71 | $root = vfsStream::setup(); |
| 72 | - $content = ['some' => 'content']; |
|
| 72 | + $content = [ 'some' => 'content' ]; |
|
| 73 | 73 | $path = $root->url() . '/some-file'; |
| 74 | 74 | |
| 75 | 75 | file_put_contents($path, json_encode($content)); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $method = 'some-method'; |
| 51 | 51 | $version = null; |
| 52 | 52 | |
| 53 | - $input = ['method' => $method, 'version' => $version]; |
|
| 53 | + $input = [ 'method' => $method, 'version' => $version ]; |
|
| 54 | 54 | |
| 55 | 55 | $this->methodProvider->shouldReceive('lookup') |
| 56 | 56 | ->with($method) |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $method = 'some-method'; |
| 69 | 69 | $version = 666; |
| 70 | - $result = ['some-result']; |
|
| 71 | - $parameter = (object) ['some-parameter']; |
|
| 72 | - $schemaContent = (object) ['some' => 'schema-content']; |
|
| 70 | + $result = [ 'some-result' ]; |
|
| 71 | + $parameter = (object) [ 'some-parameter' ]; |
|
| 72 | + $schemaContent = (object) [ 'some' => 'schema-content' ]; |
|
| 73 | 73 | $schemaFilePath = 'some-path'; |
| 74 | 74 | |
| 75 | - $input = (object) ['method' => $method, 'version' => $version, 'parameter' => $parameter]; |
|
| 75 | + $input = (object) [ 'method' => $method, 'version' => $version, 'parameter' => $parameter ]; |
|
| 76 | 76 | |
| 77 | 77 | $request = Mockery::mock(ServerRequestInterface::class); |
| 78 | 78 | $handler = Mockery::mock(ApiMethodInterface::class); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $this->methodValidator->shouldReceive('validateOutput') |
| 99 | 99 | ->with( |
| 100 | 100 | $schemaContent, |
| 101 | - Mockery::on(function ($param) use ($result): bool { |
|
| 101 | + Mockery::on(function($param) use ($result): bool { |
|
| 102 | 102 | return (array) $param == $result; |
| 103 | 103 | }) |
| 104 | 104 | ) |