Passed
Push — master ( 8e43c9...4981d1 )
by Tarmo
116:46 queued 51:34
created
src/Rest/UuidHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * /src/Rest/UuidHelper.php
5 5
  *
Please login to merge, or discard this patch.
src/Resource/ResourceCollection.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * /src/Resource/ResourceCollection.php
5 5
  *
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
     public function filter(string $className): Closure
67 67
     {
68
-        return static fn (RestResourceInterface $restResource): bool => $restResource instanceof $className;
68
+        return static fn(RestResourceInterface $restResource): bool => $restResource instanceof $className;
69 69
     }
70 70
 
71 71
     public function getErrorMessage(string $className): string
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             return null;
87 87
         }
88 88
 
89
-        $callback = static fn (RestResourceInterface $resource): bool => $resource->getEntityName() === $entityName;
89
+        $callback = static fn(RestResourceInterface $resource): bool => $resource->getEntityName() === $entityName;
90 90
 
91 91
         $filteredIterator = new CallbackFilterIterator(new IteratorIterator($iterator), $callback);
92 92
         $filteredIterator->rewind();
Please login to merge, or discard this patch.
src/Rest/ResponseHandler.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * /src/Rest/ResponseHandler.php
5 5
  *
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             );
84 84
 
85 85
             $groups = array_merge([$entityName], $populate);
86
-            $filter = static fn (string $groupName): bool => strncmp($groupName, 'Set.', 4) === 0;
86
+            $filter = static fn(string $groupName): bool => strncmp($groupName, 'Set.', 4) === 0;
87 87
 
88 88
             if (array_key_exists('populateOnly', $request->query->all())
89 89
                 || count(array_filter($groups, $filter)) > 0
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
         /** @var FormError $error */
125 125
         foreach ($form->getErrors(true) as $error) {
126
-            $name = $error->getOrigin()?->getName() ?? '';
126
+            $name = $error->getOrigin() ? ->getName() ?? '';
127 127
 
128 128
             $errors[] = sprintf(
129 129
                 'Field \'%s\': %s',
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         if ($populateAll && count($populate) === 0) {
157 157
             $associations = $restResource->getAssociations();
158 158
             $populate = array_map(
159
-                static fn (string $assocName): string => $entityName . '.' . $assocName,
159
+                static fn(string $assocName): string => $entityName . '.' . $assocName,
160 160
                 $associations,
161 161
             );
162 162
         }
Please login to merge, or discard this patch.
src/Rest/SearchTerm.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * /src/Rest/SearchTerm.php
5 5
  *
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 final class SearchTerm implements SearchTermInterface
31 31
 {
32 32
     public static function getCriteria(
33
-        array | string | null $column,
34
-        array | string | null $search,
33
+        array|string|null $column,
34
+        array|string|null $search,
35 35
         ?string $operand = null,
36 36
         ?int $mode = null,
37 37
     ): ?array {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     private static function getTermIterator(array $columns, int $mode): Closure
93 93
     {
94
-        return static fn (string $term): ?array => count($columns) > 0
94
+        return static fn(string $term): ?array => count($columns) > 0
95 95
             ? array_map(self::getColumnIterator($term, $mode), $columns)
96 96
             : null;
97 97
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
          *
109 109
          * @return array<int, string>
110 110
          */
111
-        return static fn (string $column): array => [
111
+        return static fn(string $column): array => [
112 112
             !str_contains($column, '.') ? 'entity.' . $column : $column, 'like', self::getTerm($mode, $term),
113 113
         ];
114 114
     }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      */
119 119
     private static function getTerm(int $mode, string $term): string
120 120
     {
121
-        return match ($mode) {
121
+        return match($mode) {
122 122
             self::MODE_STARTS_WITH => $term . '%',
123 123
             self::MODE_ENDS_WITH => '%' . $term,
124 124
             default => '%' . $term . '%', // self::MODE_FULL
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
      *
132 132
      * @return array<int, string>
133 133
      */
134
-    private static function getColumns(array | string | null $column): array
134
+    private static function getColumns(array|string|null $column): array
135 135
     {
136 136
         // Normalize column and search parameters
137 137
         return array_filter(
138 138
             array_map('trim', (is_array($column) ? $column : (array)(string)$column)),
139
-            static fn (string $value): bool => trim($value) !== ''
139
+            static fn(string $value) : bool => trim($value) !== ''
140 140
         );
141 141
     }
142 142
 
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
      *
148 148
      * @return array<int, string>
149 149
      */
150
-    private static function getSearchTerms(array | string | null $search): array
150
+    private static function getSearchTerms(array|string|null $search): array
151 151
     {
152 152
         return array_unique(
153 153
             array_filter(
154 154
                 array_map('trim', (is_array($search) ? $search : explode(' ', (string)$search))),
155
-                static fn (string $value): bool => trim($value) !== ''
155
+                static fn(string $value) : bool => trim($value) !== ''
156 156
             )
157 157
         );
158 158
     }
Please login to merge, or discard this patch.
src/Rest/RequestHandler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * /src/Rest/RequestHandler.php
5 5
  *
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         try {
67 67
             $where = array_filter(
68 68
                 (array)JSON::decode((string)$request->get('where', '{}'), true),
69
-                static fn ($value): bool => $value !== null,
69
+                static fn($value): bool => $value !== null,
70 70
             );
71 71
         } catch (JsonException $error) {
72 72
             throw new HttpException(
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
             $searchTerms = JSON::decode($search, true);
202 202
 
203 203
             self::checkSearchTerms($searchTerms);
204
-        } catch (JsonException | LogicException) {
204
+        } catch (JsonException|LogicException) {
205 205
             $searchTerms = null;
206 206
         }
207 207
 
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     private static function normalizeSearchTerms(array $searchTerms): array
238 238
     {
239 239
         // Normalize user input, note that this support array and string formats on value
240
-        array_walk($searchTerms, static fn (array $terms): array => array_unique(array_values(array_filter($terms))));
240
+        array_walk($searchTerms, static fn(array $terms): array => array_unique(array_values(array_filter($terms))));
241 241
 
242 242
         return $searchTerms;
243 243
     }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     private static function getIterator(array &$output): Closure
249 249
     {
250
-        return static function (string $value, string | int $key) use (&$output): void {
250
+        return static function (string $value, string|int $key) use (&$output): void {
251 251
             $order = in_array(mb_strtoupper($value), ['ASC', 'DESC'], true) ? mb_strtoupper($value) : 'ASC';
252 252
             $column = is_string($key) ? $key : $value;
253 253
 
Please login to merge, or discard this patch.
src/Rest/RepositoryHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * /src/Rest/RepositoryHelper.php
5 5
  *
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
      *
294 294
      * @return array{0: string, 1: string, 2: string|array}
295 295
      */
296
-    private static function createCriteria(string $column, string | array $value): array
296
+    private static function createCriteria(string $column, string|array $value): array
297 297
     {
298 298
         if (!str_contains($column, '.')) {
299 299
             $column = 'entity.' . $column;
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
             try {
360 360
                 $value = array_map([UuidHelper::class, 'getBytes'], $value);
361 361
             } catch (InvalidUuidStringException $error) {
362
-                (static fn (InvalidUuidStringException $error): InvalidUuidStringException => $error)($error);
362
+                (static fn(InvalidUuidStringException $error): InvalidUuidStringException => $error)($error);
363 363
             }
364 364
 
365 365
             $parameters[] = array_map(
366
-                static fn (string $value): Literal => $queryBuilder->expr()->literal(
366
+                static fn(string $value): Literal => $queryBuilder->expr()->literal(
367 367
                     is_numeric($value) ? (int)$value : $value
368 368
                 ),
369 369
                 $value
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
      */
379 379
     private static function getIterator(array &$condition): Closure
380 380
     {
381
-        return static function (string | array $value, string $column) use (&$condition): void {
381
+        return static function (string|array $value, string $column) use (&$condition): void {
382 382
             // If criteria contains 'and' OR 'or' key(s) assume that array in only in the right format
383 383
             if (strcmp($column, 'and') === 0 || strcmp($column, 'or') === 0) {
384 384
                 $condition[$column] = $value;
Please login to merge, or discard this patch.
src/Rest/Interfaces/SearchTermInterface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types = 1);
2
+declare(strict_types=1);
3 3
 /**
4 4
  * /src/Rest/Interfaces/SearchTermInterface.php
5 5
  *
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
      * @return array<string, array<string, array>>|null
39 39
      */
40 40
     public static function getCriteria(
41
-        array | string $column,
42
-        array | string $search,
41
+        array|string $column,
42
+        array|string $search,
43 43
         ?string $operand = null,
44 44
         ?int $mode = null,
45 45
     ): ?array;
Please login to merge, or discard this patch.