@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | private JsonSchemaExceptionHandlerInterface $handler, |
| 50 | 50 | private JsonSchemaRequestExceptionHandlerInterface $requestHandler, |
| 51 | 51 | #[Named('json_schema_host')] |
| 52 | - private string|null $schemaHost = null, |
|
| 52 | + private string | null $schemaHost = null, |
|
| 53 | 53 | ) { |
| 54 | 54 | } |
| 55 | 55 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | private function validateRequest(MethodInvocation $invocation, JsonSchema $jsonSchema, array $arguments): void |
| 88 | 88 | { |
| 89 | 89 | try { |
| 90 | - $schemaFile = $this->validateDir . '/' . $jsonSchema->params; |
|
| 90 | + $schemaFile = $this->validateDir.'/'.$jsonSchema->params; |
|
| 91 | 91 | $this->validateFileExists($schemaFile); |
| 92 | 92 | $this->validate($arguments, $schemaFile); |
| 93 | 93 | } catch (JsonSchemaException $e) { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | return $json; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if (! property_exists($json, $jsonSchema->key)) { |
|
| 130 | + if (!property_exists($json, $jsonSchema->key)) { |
|
| 131 | 131 | throw new JsonSchemaKeytNotFoundException($jsonSchema->key); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** @param array<mixed>|stdClass $target */ |
| 138 | - private function validate(array|stdClass $target, string $schemaFile): void |
|
| 138 | + private function validate(array | stdClass $target, string $schemaFile): void |
|
| 139 | 139 | { |
| 140 | 140 | $validator = new Validator(); |
| 141 | - $schema = (object) ['$ref' => 'file://' . $schemaFile]; |
|
| 141 | + $schema = (object) ['$ref' => 'file://'.$schemaFile]; |
|
| 142 | 142 | $scanArray = is_array($target) ? $target : $this->deepArray($target); |
| 143 | 143 | $validator->validate($scanArray, $schema, Constraint::CHECK_MODE_TYPE_CAST); |
| 144 | 144 | $isValid = $validator->isValid(); |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | private function getSchemaFile(JsonSchema $jsonSchema, ResourceObject $ro): string |
| 181 | 181 | { |
| 182 | - if (! $jsonSchema->schema) { |
|
| 182 | + if (!$jsonSchema->schema) { |
|
| 183 | 183 | // for BC only |
| 184 | 184 | new ReflectionClass($ro); |
| 185 | 185 | $roFileName = $this->getParentClassName($ro); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $schemaFile = $this->schemaDir . '/' . $jsonSchema->schema; |
|
| 192 | + $schemaFile = $this->schemaDir.'/'.$jsonSchema->schema; |
|
| 193 | 193 | $this->validateFileExists($schemaFile); |
| 194 | 194 | |
| 195 | 195 | return $schemaFile; |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | private function validateFileExists(string $schemaFile): void |
| 206 | 206 | { |
| 207 | - if (! file_exists($schemaFile) || is_dir($schemaFile)) { |
|
| 207 | + if (!file_exists($schemaFile) || is_dir($schemaFile)) { |
|
| 208 | 208 | throw new JsonSchemaNotFoundException($schemaFile); |
| 209 | 209 | } |
| 210 | 210 | } |
@@ -52,20 +52,20 @@ discard block |
||
| 52 | 52 | /** @return OptionsMethodsResponse */ |
| 53 | 53 | public function __invoke(ResourceObject $ro, string $requestMethod): array |
| 54 | 54 | { |
| 55 | - $method = new ReflectionMethod($ro::class, 'on' . $requestMethod); |
|
| 55 | + $method = new ReflectionMethod($ro::class, 'on'.$requestMethod); |
|
| 56 | 56 | $ins = $this->getInMap($method); |
| 57 | 57 | [$doc, $paramDoc] = (new OptionsMethodDocBolck())($method); |
| 58 | 58 | $methodOption = $doc; |
| 59 | 59 | $paramMetas = (new OptionsMethodRequest())($method, $paramDoc, $ins); |
| 60 | 60 | $schema = $this->getJsonSchema($method); |
| 61 | - $request = ! empty($paramMetas) ? ['request' => $paramMetas] : []; |
|
| 61 | + $request = !empty($paramMetas) ? ['request' => $paramMetas] : []; |
|
| 62 | 62 | $methodOption += $request; |
| 63 | - if (! empty($schema)) { |
|
| 63 | + if (!empty($schema)) { |
|
| 64 | 64 | $methodOption += ['schema' => $schema]; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $extras = $this->getMethodExtras($method); |
| 68 | - if (! empty($extras)) { |
|
| 68 | + if (!empty($extras)) { |
|
| 69 | 69 | $methodOption += $extras; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $extras['links'][] = $annotation; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if (! ($annotation instanceof Embed)) { |
|
| 89 | + if (!($annotation instanceof Embed)) { |
|
| 90 | 90 | continue; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | private function getJsonSchema(ReflectionMethod $method): array |
| 109 | 109 | { |
| 110 | 110 | $schema = $method->getAnnotation(JsonSchema::class); |
| 111 | - if (! $schema instanceof JsonSchema) { |
|
| 111 | + if (!$schema instanceof JsonSchema) { |
|
| 112 | 112 | return []; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $schemaFile = $this->schemaDir . '/' . $schema->schema; |
|
| 116 | - if (! file_exists($schemaFile)) { |
|
| 115 | + $schemaFile = $this->schemaDir.'/'.$schema->schema; |
|
| 116 | + if (!file_exists($schemaFile)) { |
|
| 117 | 117 | return []; |
| 118 | 118 | } |
| 119 | 119 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $attributes = $parameter->getAttributes(); |
| 135 | 135 | foreach ($attributes as $attribute) { |
| 136 | 136 | $instance = $attribute->newInstance(); |
| 137 | - if (! ($instance instanceof AbstractWebContextParam)) { |
|
| 137 | + if (!($instance instanceof AbstractWebContextParam)) { |
|
| 138 | 138 | continue; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** @psalm-return DefaultParam<mixed>|NoDefaultParam */ |
| 132 | - private function getDefault(ReflectionParameter $parameter): DefaultParam|NoDefaultParam |
|
| 132 | + private function getDefault(ReflectionParameter $parameter): DefaultParam | NoDefaultParam |
|
| 133 | 133 | { |
| 134 | 134 | return $parameter->isDefaultValueAvailable() === true ? new DefaultParam($parameter->getDefaultValue()) : new NoDefaultParam(); |
| 135 | 135 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | private function getParam(ReflectionParameter $parameter): ParamInterface |
| 157 | 157 | { |
| 158 | 158 | $type = $parameter->getType(); |
| 159 | - if ($type instanceof ReflectionNamedType && ! $type->isBuiltin()) { |
|
| 159 | + if ($type instanceof ReflectionNamedType && !$type->isBuiltin()) { |
|
| 160 | 160 | return new ClassParam($type, $parameter); |
| 161 | 161 | } |
| 162 | 162 | |