Completed
Push — 1.x ( 53882c...90de9d )
by Akihito
12s
created
src/PrettyJsonRenderer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,15 +24,15 @@
 block discarded – undo
24 24
     #[Override]
25 25
     public function render(ResourceObject $ro)
26 26
     {
27
-        if (! array_key_exists('Content-Type', $ro->headers)) {
27
+        if (!array_key_exists('Content-Type', $ro->headers)) {
28 28
             $ro->headers['Content-Type'] = 'application/json';
29 29
         }
30 30
 
31
-        $ro->view = (string) json_encode($ro, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT) . PHP_EOL;
31
+        $ro->view = (string) json_encode($ro, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT).PHP_EOL;
32 32
         $e = json_last_error();
33 33
         if ($e) {
34 34
             // @codeCoverageIgnoreStart
35
-            error_log('json_encode error: ' . json_last_error_msg() . ' in ' . __METHOD__);
35
+            error_log('json_encode error: '.json_last_error_msg().' in '.__METHOD__);
36 36
 
37 37
             return '';
38 38
 
Please login to merge, or discard this patch.
src/InputFormParam.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@
 block discarded – undo
39 39
      * @param RequestQuery $query
40 40
      */
41 41
     #[Override]
42
-    public function __invoke(string $varName, array $query, InjectorInterface $injector): AbstractFileUpload|null
42
+    public function __invoke(string $varName, array $query, InjectorInterface $injector): AbstractFileUpload | null
43 43
     {
44 44
         // When user sets the FileUpload object, return it directly
45 45
         if (array_key_exists($varName, $query)) {
46 46
             $value = $query[$varName];
47 47
             // Type check: ensure the value is a valid file upload object or null
48
-            if ($value !== null && ! ($value instanceof FileUpload) && ! ($value instanceof ErrorFileUpload)) {
48
+            if ($value !== null && !($value instanceof FileUpload) && !($value instanceof ErrorFileUpload)) {
49 49
                 throw new InvalidArgumentException($varName);
50 50
             }
51 51
 
Please login to merge, or discard this patch.
src/SchemeCollection.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     #[Override]
46 46
     public function toAdapter(AdapterInterface $adapter): SchemeCollectionInterface
47 47
     {
48
-        $this->collection[$this->scheme . '://' . $this->appName] = $adapter;
48
+        $this->collection[$this->scheme.'://'.$this->appName] = $adapter;
49 49
 
50 50
         return $this;
51 51
     }
@@ -58,13 +58,13 @@  discard block
 block discarded – undo
58 58
     #[Override]
59 59
     public function getAdapter(AbstractUri $uri): AdapterInterface
60 60
     {
61
-        $schemeIndex = $uri->scheme . '://' . $uri->host;
62
-        if (! array_key_exists($schemeIndex, $this->collection)) {
61
+        $schemeIndex = $uri->scheme.'://'.$uri->host;
62
+        if (!array_key_exists($schemeIndex, $this->collection)) {
63 63
             if ($uri->scheme === 'http' || $uri->scheme === 'https') {
64 64
                 return $this->collection['http://self'];
65 65
             }
66 66
 
67
-            throw new SchemeException($uri->scheme . '://' . $uri->host);
67
+            throw new SchemeException($uri->scheme.'://'.$uri->host);
68 68
         }
69 69
 
70 70
         return $this->collection[$schemeIndex];
Please login to merge, or discard this patch.
src/AppIterator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     /** @throws ResourceDirException */
40 40
     public function __construct(string $resourceDir)
41 41
     {
42
-        if (! file_exists($resourceDir)) {
42
+        if (!file_exists($resourceDir)) {
43 43
             throw new ResourceDirException($resourceDir);
44 44
         }
45 45
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             }
111 111
 
112 112
             $resourceClass = $this->getResourceClassName($item);
113
-            if ($resourceClass === '' || ! class_exists($resourceClass)) {
113
+            if ($resourceClass === '' || !class_exists($resourceClass)) {
114 114
                 continue;
115 115
             }
116 116
 
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $isPhp = $item->isFile()
127 127
             && $item->getExtension() === 'php'
128
-            && (! str_contains($item->getBasename('.php'), '.'));
128
+            && (!str_contains($item->getBasename('.php'), '.'));
129 129
 
130
-        return ! $isPhp;
130
+        return !$isPhp;
131 131
     }
132 132
 
133 133
     /** @return ResourceClassName|'' */
Please login to merge, or discard this patch.
src/ProdLogger.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     public function __invoke(ResourceObject $ro): void
22 22
     {
23 23
         $unsafeMethod = ['post', 'put', 'patch', 'delete'];
24
-        if (! in_array($ro->uri->method, $unsafeMethod, true)) {
24
+        if (!in_array($ro->uri->method, $unsafeMethod, true)) {
25 25
             return;
26 26
         }
27 27
 
Please login to merge, or discard this patch.
src/NullRequest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 {
12 12
     /** @param Query $query */
13 13
     #[Override]
14
-    public function __invoke(array|null $query = null): ResourceObject
14
+    public function __invoke(array | null $query = null): ResourceObject
15 15
     {
16 16
         return new NullResourceObject();
17 17
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     #[Override]
60 60
     public function toUriWithMethod(): string
61 61
     {
62
-        return 'get ' . (string) new NullUri();
62
+        return 'get '.(string) new NullUri();
63 63
     }
64 64
 
65 65
     /** @return self */
Please login to merge, or discard this patch.
src/HalRenderer.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
     public function renderHal(ResourceObject $ro): void
54 54
     {
55 55
         [$ro, $body] = $this->valuate($ro);
56
-        $method = 'on' . ucfirst($ro->uri->method);
56
+        $method = 'on'.ucfirst($ro->uri->method);
57 57
         $hasMethod = method_exists($ro, $method);
58 58
         $annotations = $hasMethod ? (new ReflectionMethod($ro, $method))->getAnnotations() : [];
59 59
         $hal = $this->getHal($ro->uri, $body, $annotations);
60 60
         $json = $hal->asJson(true);
61 61
         assert(is_string($json));
62
-        $ro->view = $json . PHP_EOL;
62
+        $ro->view = $json.PHP_EOL;
63 63
         $ro->headers['Content-Type'] = 'application/hal+json';
64 64
     }
65 65
 
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
         assert(is_array($ro->body));
69 69
         /** @var mixed $embeded */
70 70
         foreach ($ro->body as $key => &$embeded) {
71
-            if (! ($embeded instanceof AbstractRequest)) {
71
+            if (!($embeded instanceof AbstractRequest)) {
72 72
                 continue;
73 73
             }
74 74
 
75
-            $isNotArray = ! isset($ro->body['_embedded']) || ! is_array($ro->body['_embedded']);
75
+            $isNotArray = !isset($ro->body['_embedded']) || !is_array($ro->body['_embedded']);
76 76
             if ($isNotArray) {
77 77
                 $ro->body['_embedded'] = [];
78 78
             }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     /** @codeCoverageIgnore */
97 97
     private function isDifferentSchema(ResourceObject $parentRo, ResourceObject $childRo): bool
98 98
     {
99
-        return $parentRo->uri->scheme . $parentRo->uri->host !== $childRo->uri->scheme . $childRo->uri->host;
99
+        return $parentRo->uri->scheme.$parentRo->uri->host !== $childRo->uri->scheme.$childRo->uri->host;
100 100
     }
101 101
 
102 102
     /**
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
      */
107 107
     private function getHal(AbstractUri $uri, array $body, array $annotations): Hal
108 108
     {
109
-        $query = $uri->query ? '?' . http_build_query($uri->query) : '';
110
-        $path = $uri->path . $query;
109
+        $query = $uri->query ? '?'.http_build_query($uri->query) : '';
110
+        $path = $uri->path.$query;
111 111
         $selfLink = $this->linker->getReverseLink($path, $uri->query);
112 112
         $hal = new Hal($selfLink, $body);
113 113
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     private function updateHeaders(ResourceObject $ro): void
140 140
     {
141 141
         $ro->headers['Content-Type'] = 'application/hal+json';
142
-        if (! isset($ro->headers['Location'])) {
142
+        if (!isset($ro->headers['Location'])) {
143 143
             return;
144 144
         }
145 145
 
Please login to merge, or discard this patch.
src/JsonRenderer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     #[Override]
21 21
     public function render(ResourceObject $ro)
22 22
     {
23
-        if (! array_key_exists('Content-Type', $ro->headers)) {
23
+        if (!array_key_exists('Content-Type', $ro->headers)) {
24 24
             $ro->headers['Content-Type'] = 'application/json';
25 25
         }
26 26
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         if ($e) {
30 30
             // @codeCoverageIgnoreStart
31 31
             $msg = json_last_error_msg();
32
-            error_log('json_encode error: ' . $msg . ' in ' . __METHOD__);
32
+            error_log('json_encode error: '.$msg.' in '.__METHOD__);
33 33
 
34 34
             return '';
35 35
 
Please login to merge, or discard this patch.
src/ResourceObject.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         if (is_array($this->body)) {
90 90
             /** @psalm-suppress MixedAssignment */
91 91
             foreach ($this->body as &$item) {
92
-                if (! ($item instanceof RequestInterface)) {
92
+                if (!($item instanceof RequestInterface)) {
93 93
                     continue;
94 94
                 }
95 95
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             $this->body = [];
135 135
         }
136 136
 
137
-        if (! is_array($this->body)) {
137
+        if (!is_array($this->body)) {
138 138
             throw new IlligalAccessException((string) $offset);
139 139
         }
140 140
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      */
191 191
     public function ksort(): void
192 192
     {
193
-        if (! is_array($this->body)) {
193
+        if (!is_array($this->body)) {
194 194
             return;
195 195
         }
196 196
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      */
203 203
     public function asort(): void
204 204
     {
205
-        if (! is_array($this->body)) {
205
+        if (!is_array($this->body)) {
206 206
             return;
207 207
         }
208 208
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
             return $this->view;
239 239
         }
240 240
 
241
-        if (! $this->renderer instanceof RenderInterface) {
241
+        if (!$this->renderer instanceof RenderInterface) {
242 242
             $this->renderer = new JsonRenderer();
243 243
         }
244 244
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
     public function jsonSerialize(): array
251 251
     {
252 252
         /** @psalm-suppress MixedAssignment */
253
-        if (! is_iterable($this->body)) {
253
+        if (!is_iterable($this->body)) {
254 254
             return ['value' => $this->body];
255 255
         }
256 256
 
Please login to merge, or discard this patch.