Passed
Pull Request — 1.x (#334)
by Akihito
02:28
created
src/JsonSchema/Module/JsonSchemaLinkHeaderModule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
     /** @param string $jsonSchemaHost Json-schema host name ex) https://example.com/schema/ */
18 18
     public function __construct(
19 19
         private readonly string $jsonSchemaHost,
20
-        AbstractModule|null $module = null,
20
+        AbstractModule | null $module = null,
21 21
     ) {
22
-        if (! filter_var($jsonSchemaHost, FILTER_VALIDATE_URL)) {
22
+        if (!filter_var($jsonSchemaHost, FILTER_VALIDATE_URL)) {
23 23
             throw new InvalidSchemaUriException($jsonSchemaHost);
24 24
         }
25 25
 
Please login to merge, or discard this patch.
src/JsonSchema/Interceptor/JsonSchemaInterceptor.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         private readonly JsonSchemaExceptionHandlerInterface $handler,
45 45
         private readonly JsonSchemaRequestExceptionHandlerInterface $requestHandler,
46 46
         #[Named('json_schema_host')]
47
-        private readonly string|null $schemaHost = null,
47
+        private readonly string | null $schemaHost = null,
48 48
     ) {
49 49
     }
50 50
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     private function validateRequest(MethodInvocation $invocation, JsonSchema $jsonSchema, array $arguments): void // @phpstan-ignore-line
76 76
     {
77 77
         try {
78
-            $schemaFile = $this->validateDir . '/' . $jsonSchema->params;
78
+            $schemaFile = $this->validateDir.'/'.$jsonSchema->params;
79 79
             $this->validateFileExists($schemaFile);
80 80
             $this->validate($arguments, $schemaFile);
81 81
         } catch (JsonSchemaException $e) {
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             return $json;
116 116
         }
117 117
 
118
-        if (! property_exists($json, $jsonSchema->key)) {
118
+        if (!property_exists($json, $jsonSchema->key)) {
119 119
             throw new JsonSchemaKeytNotFoundException($jsonSchema->key);
120 120
         }
121 121
 
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
     }
124 124
 
125 125
     /** @param array<mixed>|stdClass $target */
126
-    private function validate(array|stdClass $target, string $schemaFile): void
126
+    private function validate(array | stdClass $target, string $schemaFile): void
127 127
     {
128 128
         $validator = new Validator();
129
-        $schema = (object) ['$ref' => 'file://' . $schemaFile];
129
+        $schema = (object) ['$ref' => 'file://'.$schemaFile];
130 130
         $scanArray = is_array($target) ? $target : $this->deepArray($target);
131 131
         $validator->validate($scanArray, $schema, Constraint::CHECK_MODE_TYPE_CAST);
132 132
         $isValid = $validator->isValid();
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
     private function getSchemaFile(JsonSchema $jsonSchema, ResourceObject $ro): string
168 168
     {
169
-        if (! $jsonSchema->schema) {
169
+        if (!$jsonSchema->schema) {
170 170
             // for BC only
171 171
             new ReflectionClass($ro);
172 172
             $roFileName = $this->getParentClassName($ro);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
             }
177 177
         }
178 178
 
179
-        $schemaFile = $this->schemaDir . '/' . $jsonSchema->schema;
179
+        $schemaFile = $this->schemaDir.'/'.$jsonSchema->schema;
180 180
         $this->validateFileExists($schemaFile);
181 181
 
182 182
         return $schemaFile;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
     private function validateFileExists(string $schemaFile): void
193 193
     {
194
-        if (! file_exists($schemaFile) || is_dir($schemaFile)) {
194
+        if (!file_exists($schemaFile) || is_dir($schemaFile)) {
195 195
             throw new JsonSchemaNotFoundException($schemaFile);
196 196
         }
197 197
     }
Please login to merge, or discard this patch.
src/JsonSchema/JsonSchemaExceptionFakeHandler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     /** @return array<int|string, mixed> */
35 35
     private function fakeResponse(string $schemaFile): array
36 36
     {
37
-        if (! class_exists(Faker::class)) {
37
+        if (!class_exists(Faker::class)) {
38 38
             throw new LogicException('"koriym/json-schema-faker" not installed. Please run "composer require koriym/json-schema-faker --dev". See more at https://github.com/bearsunday/BEAR.Resource/wiki/json_schema_faker_required'); // @codeCoverageIgnore
39 39
         }
40 40
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      *
50 50
      * @return array<int|string, mixed>
51 51
      */
52
-    private function deepArray(array|stdClass $values): array
52
+    private function deepArray(array | stdClass $values): array
53 53
     {
54 54
         $result = [];
55 55
         /** @psalm-suppress MixedAssignment */
Please login to merge, or discard this patch.
src/ExtraMethodInvoker.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,6 +33,6 @@
 block discarded – undo
33 33
             return $ro;
34 34
         }
35 35
 
36
-        throw new MethodNotAllowedException($request->resourceObject::class . "::{({$request->method}}()", 405);
36
+        throw new MethodNotAllowedException($request->resourceObject::class."::{({$request->method}}()", 405);
37 37
     }
38 38
 }
Please login to merge, or discard this patch.