Passed
Push — php82 ( 90de9d...10bbbe )
by Akihito
03:34
created
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
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/Meta.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $scheme = array_shift($classPath);
59 59
         assert(is_string($scheme));
60 60
 
61
-        return strtolower("{$scheme}://self/" . implode('/', $classPath));
61
+        return strtolower("{$scheme}://self/".implode('/', $classPath));
62 62
     }
63 63
 
64 64
     /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     private function getOptions(string $class): Options
70 70
     {
71
-        if (! class_exists($class)) {
71
+        if (!class_exists($class)) {
72 72
             throw new LogicException(); // @codeCoverageIgnore
73 73
         }
74 74
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
     {
93 93
         $allows = [];
94 94
         foreach ($methods as $method) {
95
-            $isRequestMethod = str_starts_with($method->name, 'on') && ! str_starts_with($method->name, 'onLink');
96
-            if (! $isRequestMethod) {
95
+            $isRequestMethod = str_starts_with($method->name, 'on') && !str_starts_with($method->name, 'onLink');
96
+            if (!$isRequestMethod) {
97 97
                 continue;
98 98
             }
99 99
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     /** @param ResourceClassName $class */
107 107
     private function getParams(string $class, string $method): Params
108 108
     {
109
-        $refMethod = new ReflectionMethod($class, 'on' . $method);
109
+        $refMethod = new ReflectionMethod($class, 'on'.$method);
110 110
         $parameters = $refMethod->getParameters();
111 111
         $optionalParams = $requiredParams = [];
112 112
         foreach ($parameters as $parameter) {
Please login to merge, or discard this patch.
src/OptionsMethodRequest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      *
39 39
      * @psalm-suppress RedundantCondition for BC
40 40
      */
41
-    private function getParameterType(ReflectionParameter $parameter, array $paramDoc, string $name): string|null
41
+    private function getParameterType(ReflectionParameter $parameter, array $paramDoc, string $name): string | null
42 42
     {
43 43
         /** @phpstan-ignore function.alreadyNarrowedType */
44 44
         $hasType = method_exists($parameter, 'getType') && $parameter->getType();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                 $paramDoc[$name]['in'] = $ins[$parameter->name];
65 65
             }
66 66
 
67
-            if (! isset($paramDoc[$parameter->name])) {
67
+            if (!isset($paramDoc[$parameter->name])) {
68 68
                 $paramDoc[$name] = [];
69 69
             }
70 70
 
Please login to merge, or discard this patch.
src/NamedParamMetas.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $method = new ReflectionMethod($callable[0], $callable[1]); // @phpstan-ignore-line
40 40
         $paramMetas = $this->getAttributeParamMetas($method);
41 41
 
42
-        if (! $paramMetas) {
42
+        if (!$paramMetas) {
43 43
             $paramMetas = $this->getAnnotationParamMetas($method);
44 44
         }
45 45
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 $names[$annotation->param] = new AssistedResourceParam($annotation);
122 122
             }
123 123
 
124
-            if (! ($annotation instanceof Assisted)) {
124
+            if (!($annotation instanceof Assisted)) {
125 125
                 continue;
126 126
             }
127 127
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     {
143 143
         $webcontext = [];
144 144
         foreach ($annotations as $annotation) {
145
-            if (! ($annotation instanceof AbstractWebContextParam)) {
145
+            if (!($annotation instanceof AbstractWebContextParam)) {
146 146
                 continue;
147 147
             }
148 148
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     }
219 219
 
220 220
     /** @psalm-return DefaultParam<mixed>|NoDefaultParam */
221
-    private function getDefault(ReflectionParameter $parameter): DefaultParam|NoDefaultParam
221
+    private function getDefault(ReflectionParameter $parameter): DefaultParam | NoDefaultParam
222 222
     {
223 223
         return $parameter->isDefaultValueAvailable() === true ? new DefaultParam($parameter->getDefaultValue()) : new NoDefaultParam();
224 224
     }
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     private function getParam(ReflectionParameter $parameter): ParamInterface
249 249
     {
250 250
         $type = $parameter->getType();
251
-        if ($type instanceof ReflectionNamedType && ! $type->isBuiltin()) {
251
+        if ($type instanceof ReflectionNamedType && !$type->isBuiltin()) {
252 252
             return new ClassParam($type, $parameter);
253 253
         }
254 254
 
Please login to merge, or discard this patch.
src/HalLinker.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function addHalLink(array $body, array $methodAnnotations, Hal $hal): Hal
37 37
     {
38
-        if (! empty($methodAnnotations)) {
38
+        if (!empty($methodAnnotations)) {
39 39
             $hal = $this->linkAnnotation($body, $methodAnnotations, $hal);
40 40
         }
41 41
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     private function linkAnnotation(array $body, array $methodAnnotations, Hal $hal): Hal
55 55
     {
56 56
         foreach ($methodAnnotations as $annotation) {
57
-            if (! $annotation instanceof Link) {
57
+            if (!$annotation instanceof Link) {
58 58
                 continue;
59 59
             }
60 60
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     private function bodyLink(array $body, Hal $hal): Hal
81 81
     {
82 82
         foreach ($body['_links'] as $rel => $link) {
83
-            if (! isset($link['href'])) {
83
+            if (!isset($link['href'])) {
84 84
                 // @codeCoverageIgnoreStart
85 85
                 continue;
86 86
                 // @codeCoverageIgnoreEnd
Please login to merge, or discard this patch.
src/Linker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
      */
110 110
     private function annotationLink(LinkType $link, ResourceObject $current, AbstractRequest $request): ResourceObject
111 111
     {
112
-        if (! is_array($current->body)) {
113
-            throw new Exception\LinkQueryException('Only array is allowed for link in ' . $current::class, 500);
112
+        if (!is_array($current->body)) {
113
+            throw new Exception\LinkQueryException('Only array is allowed for link in '.$current::class, 500);
114 114
         }
115 115
 
116
-        $classMethod = 'on' . ucfirst($request->method);
116
+        $classMethod = 'on'.ucfirst($request->method);
117 117
         /** @var list<Link> $annotations */
118 118
         $annotations = (new ReflectionMethod($current::class, $classMethod))->getAnnotations();
119 119
         if ($link->type === LinkType::CRAWL_LINK) {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
             return $this->invoker->invoke($request);
152 152
         }
153 153
 
154
-        throw new LinkRelException("rel:{$link->key} class:" . $current::class, 500);
154
+        throw new LinkRelException("rel:{$link->key} class:".$current::class, 500);
155 155
     }
156 156
 
157 157
     /**
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     private function crawl(array $annotations, LinkType $link, array &$body): void
191 191
     {
192 192
         foreach ($annotations as $annotation) {
193
-            if (! $annotation instanceof Link || $annotation->crawl !== $link->key) {
193
+            if (!$annotation instanceof Link || $annotation->crawl !== $link->key) {
194 194
                 continue;
195 195
             }
196 196
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     }
213 213
 
214 214
     /** @return Body|null */
215
-    private function getResponseBody(Request $request): array|null
215
+    private function getResponseBody(Request $request): array | null
216 216
     {
217 217
         $body = $this->invokeRecursive($request)->body;
218 218
         assert(is_array($body) || $body === null);
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
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     /** @return Body */
36 36
     private function fakeResponse(string $schemaFile): array
37 37
     {
38
-        if (! class_exists(Faker::class)) {
38
+        if (!class_exists(Faker::class)) {
39 39
             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
40 40
         }
41 41
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      *
51 51
      * @return Body
52 52
      */
53
-    private function deepArray(array|stdClass $values): array
53
+    private function deepArray(array | stdClass $values): array
54 54
     {
55 55
         $result = [];
56 56
         /** @psalm-suppress MixedAssignment */
Please login to merge, or discard this patch.
src/InputFormsParam.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     private function getUserFileUploads(string $varName, array $query): array
66 66
     {
67 67
         $fileUploads = $query[$varName];
68
-        if (! is_array($fileUploads)) {
68
+        if (!is_array($fileUploads)) {
69 69
             throw new InvalidArgumentException($varName); // Invalid type of array
70 70
         }
71 71
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         assert(count($fileUploads) > 0);
75 75
         foreach ($fileUploads as $fileUpload) {
76
-            if (! ($fileUpload instanceof FileUpload) && ! ($fileUpload instanceof ErrorFileUpload)) {
76
+            if (!($fileUpload instanceof FileUpload) && !($fileUpload instanceof ErrorFileUpload)) {
77 77
                 throw new InvalidArgumentException($varName); // Invalid item of array tye of FileUpload or ErrorFileUpload
78 78
             }
79 79
         }
Please login to merge, or discard this patch.