Passed
Pull Request — master (#1578)
by Tarmo
64:45 queued 03:31
created
src/Rest/SearchTerm.php 1 patch
Spacing   +14 added lines, -14 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
  *
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 final class SearchTerm implements SearchTermInterface
34 34
 {
35 35
     public static function getCriteria(
36
-        array | string | null $column,
37
-        array | string | null $search,
36
+        array|string|null $column,
37
+        array|string|null $search,
38 38
         ?string $operand = null,
39 39
         ?int $mode = null,
40 40
     ): ?array {
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     private static function getTermIterator(array $columns, int $mode): Closure
96 96
     {
97
-        return static fn (string $term): ?array => $columns === []
97
+        return static fn(string $term): ?array => $columns === []
98 98
             ? null
99 99
             : array_map(self::getColumnIterator($term, $mode), $columns);
100 100
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
          *
112 112
          * @return array<int, string>
113 113
          */
114
-        return static fn (string $column): array => [
114
+        return static fn(string $column): array => [
115 115
             str_contains($column, '.') ? $column : 'entity.' . $column, 'like', self::getTerm($mode, $term),
116 116
         ];
117 117
     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     private static function getTerm(int $mode, string $term): string
123 123
     {
124
-        return match ($mode) {
124
+        return match($mode) {
125 125
             self::MODE_STARTS_WITH => $term . '%',
126 126
             self::MODE_ENDS_WITH => '%' . $term,
127 127
             default => '%' . $term . '%', // self::MODE_FULL
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      *
134 134
      * @return array<int, string>
135 135
      */
136
-    private static function getColumns(array | string | null $column): array
136
+    private static function getColumns(array|string|null $column): array
137 137
     {
138 138
         // Normalize columns
139 139
         return $column === null
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
                 array_map(
143 143
                     'trim',
144 144
                     (is_array($column)
145
-                        ? array_filter($column, static fn (string | null $column): bool => is_string($column))
145
+                        ? array_filter($column, static fn(string|null $column) : bool => is_string($column))
146 146
                         : (array)$column),
147 147
                 ),
148
-                static fn (string $value): bool => trim($value) !== '',
148
+                static fn(string $value) : bool => trim($value) !== '',
149 149
             );
150 150
     }
151 151
 
@@ -156,14 +156,14 @@  discard block
 block discarded – undo
156 156
      *
157 157
      * @return array<int, string>
158 158
      */
159
-    private static function getSearchTerms(array | string | null $search): array
159
+    private static function getSearchTerms(array|string|null $search): array
160 160
     {
161 161
         if (is_string($search)) {
162 162
             preg_match_all('#([^\"]\S*|\".+?\")\s*#', trim($search), $matches);
163 163
 
164 164
             if ($matches[1]) {
165 165
                 $search = array_map(
166
-                    static fn (string $term): string => trim(str_replace('"', '', $term)),
166
+                    static fn(string $term): string => trim(str_replace('"', '', $term)),
167 167
                     $matches[1],
168 168
                 );
169 169
             }
@@ -174,15 +174,15 @@  discard block
 block discarded – undo
174 174
             : array_unique(
175 175
                 array_filter(
176 176
                     array_map(
177
-                        static fn (string $term): string => (string)preg_replace('#\s+#', ' ', $term),
177
+                        static fn(string $term) : string => (string)preg_replace('#\s+#', ' ', $term),
178 178
                         array_map(
179 179
                             'trim',
180 180
                             (is_array($search)
181
-                                ? array_filter($search, static fn (string | null $term): bool => is_string($term))
181
+                                ? array_filter($search, static fn(string|null $term) : bool => is_string($term))
182 182
                                 : explode(' ', $search)),
183 183
                         ),
184 184
                     ),
185
-                    static fn (string $value): bool => trim($value) !== ''
185
+                    static fn(string $value) : bool => trim($value) !== ''
186 186
                 )
187 187
             );
188 188
     }
Please login to merge, or discard this patch.