Passed
Branch release/v3.0.0 (0e0f96)
by Anatoly
04:22
created
Category
src/Codec/JsonCodec.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
         /** @var int<1, 2147483647> $decodingMaxDepth */
66 66
         $decodingMaxDepth = $context[self::CONTEXT_KEY_DECODING_MAX_DEPTH] ?? self::DEFAULT_CODING_MAX_DEPTH;
67 67
 
68
-        $decodingFlags |= JSON_OBJECT_AS_ARRAY | JSON_BIGINT_AS_STRING;
68
+        $decodingFlags |= JSON_OBJECT_AS_ARRAY|JSON_BIGINT_AS_STRING;
69 69
 
70 70
         try {
71
-            return json_decode($data, depth: $decodingMaxDepth, flags: $decodingFlags | JSON_THROW_ON_ERROR);
71
+            return json_decode($data, depth: $decodingMaxDepth, flags: $decodingFlags|JSON_THROW_ON_ERROR);
72 72
         } catch (JsonException $e) {
73 73
             throw new CodecException($e->getMessage(), previous: $e);
74 74
         }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $encodingMaxDepth = $context[self::CONTEXT_KEY_ENCODING_MAX_DEPTH] ?? self::DEFAULT_CODING_MAX_DEPTH;
88 88
 
89 89
         try {
90
-            return json_encode($data, flags: $encodingFlags | JSON_THROW_ON_ERROR, depth: $encodingMaxDepth);
90
+            return json_encode($data, flags: $encodingFlags|JSON_THROW_ON_ERROR, depth: $encodingMaxDepth);
91 91
         } catch (JsonException $e) {
92 92
             throw new CodecException($e->getMessage(), previous: $e);
93 93
         }
Please login to merge, or discard this patch.
src/Helper/RouteParser.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
             if ($route[$offset] === '(' && !($cursor & self::IN_VARIABLE)) {
67 67
                 if (($cursor & self::IN_OPTIONAL_PART)) {
68 68
                     throw new InvalidArgumentException(sprintf(
69
-                        'The route "%s" could not be parsed due to a syntax error. ' .
70
-                        'The attempt to open an optional part at position %d failed ' .
69
+                        'The route "%s" could not be parsed due to a syntax error. '.
70
+                        'The attempt to open an optional part at position %d failed '.
71 71
                         'because nested optional parts are not supported.',
72 72
                         $route,
73 73
                         $offset,
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
             if ($route[$offset] === ')' && !($cursor & self::IN_VARIABLE)) {
81 81
                 if (!($cursor & self::IN_OPTIONAL_PART)) {
82 82
                     throw new InvalidArgumentException(sprintf(
83
-                        'The route "%s" could not be parsed due to a syntax error. ' .
84
-                        'The attempt to close an optional part at position %d failed ' .
83
+                        'The route "%s" could not be parsed due to a syntax error. '.
84
+                        'The attempt to close an optional part at position %d failed '.
85 85
                         'because an open optional part was not found.',
86 86
                         $route,
87 87
                         $offset,
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                 if (($cursor & self::IN_OCCUPIED_PART)) {
92 92
                     $cursor &= ~self::IN_OCCUPIED_PART;
93 93
                     // phpcs:ignore Generic.Files.LineLength.TooLong
94
-                    $variables[$variable]['optional_part'] = '(' . $left . ($variables[$variable]['statement'] ?? '') . $right . ')';
94
+                    $variables[$variable]['optional_part'] = '('.$left.($variables[$variable]['statement'] ?? '').$right.')';
95 95
                 }
96 96
 
97 97
                 $cursor &= ~self::IN_OPTIONAL_PART;
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
             if ($route[$offset] === '{' && !($cursor & self::IN_VARIABLE_PATTERN)) {
103 103
                 if (($cursor & self::IN_VARIABLE)) {
104 104
                     throw new InvalidArgumentException(sprintf(
105
-                        'The route "%s" could not be parsed due to a syntax error. ' .
106
-                        'The attempt to open a variable at position %d failed ' .
105
+                        'The route "%s" could not be parsed due to a syntax error. '.
106
+                        'The attempt to open a variable at position %d failed '.
107 107
                         'because nested variables are not supported.',
108 108
                         $route,
109 109
                         $offset,
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
                 }
112 112
                 if (($cursor & self::IN_OCCUPIED_PART)) {
113 113
                     throw new InvalidArgumentException(sprintf(
114
-                        'The route "%s" could not be parsed due to a syntax error. ' .
115
-                        'The attempt to open a variable at position %d failed ' .
114
+                        'The route "%s" could not be parsed due to a syntax error. '.
115
+                        'The attempt to open a variable at position %d failed '.
116 116
                         'because more than one variable inside an optional part is not supported.',
117 117
                         $route,
118 118
                         $offset,
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
                     $cursor |= self::IN_OCCUPIED_PART;
124 124
                 }
125 125
 
126
-                $cursor |= self::IN_VARIABLE | self::IN_VARIABLE_NAME;
126
+                $cursor |= self::IN_VARIABLE|self::IN_VARIABLE_NAME;
127 127
                 $variable++;
128 128
                 continue;
129 129
             }
130 130
             if ($route[$offset] === '}' && !($cursor & self::IN_VARIABLE_PATTERN)) {
131 131
                 if (!($cursor & self::IN_VARIABLE)) {
132 132
                     throw new InvalidArgumentException(sprintf(
133
-                        'The route "%s" could not be parsed due to a syntax error. ' .
134
-                        'The attempt to close a variable at position %d failed ' .
133
+                        'The route "%s" could not be parsed due to a syntax error. '.
134
+                        'The attempt to close a variable at position %d failed '.
135 135
                         'because an open variable was not found.',
136 136
                         $route,
137 137
                         $offset,
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
                 }
140 140
                 if (!isset($variables[$variable]['name'])) {
141 141
                     throw new InvalidArgumentException(sprintf(
142
-                        'The route "%s" could not be parsed due to a syntax error. ' .
143
-                        'The attempt to close a variable at position %d failed ' .
142
+                        'The route "%s" could not be parsed due to a syntax error. '.
143
+                        'The attempt to close a variable at position %d failed '.
144 144
                         'because its name is required for its declaration.',
145 145
                         $route,
146 146
                         $offset,
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                 }
149 149
                 if (isset($names[$variables[$variable]['name']])) {
150 150
                     throw new InvalidArgumentException(sprintf(
151
-                        'The route "%s" at position %d could not be parsed ' .
151
+                        'The route "%s" at position %d could not be parsed '.
152 152
                         'because the variable name "%s" is already in use.',
153 153
                         $route,
154 154
                         $offset,
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
                     ));
157 157
                 }
158 158
 
159
-                $cursor &= ~(self::IN_VARIABLE | self::IN_VARIABLE_NAME);
160
-                $variables[$variable]['statement'] = '{' . ($variables[$variable]['statement'] ?? '') . '}';
159
+                $cursor &= ~(self::IN_VARIABLE|self::IN_VARIABLE_NAME);
160
+                $variables[$variable]['statement'] = '{'.($variables[$variable]['statement'] ?? '').'}';
161 161
                 $names[$variables[$variable]['name']] = true; // @phpstan-ignore-line
162 162
                 continue;
163 163
             }
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
             if ($route[$offset] === '<' && ($cursor & self::IN_VARIABLE)) {
171 171
                 if (($cursor & self::IN_VARIABLE_PATTERN)) {
172 172
                     throw new InvalidArgumentException(sprintf(
173
-                        'The route "%s" could not be parsed due to a syntax error. ' .
174
-                        'The attempt to open a variable pattern at position %d failed ' .
173
+                        'The route "%s" could not be parsed due to a syntax error. '.
174
+                        'The attempt to open a variable pattern at position %d failed '.
175 175
                         'because nested patterns are not supported.',
176 176
                         $route,
177 177
                         $offset,
@@ -179,22 +179,22 @@  discard block
 block discarded – undo
179 179
                 }
180 180
                 if (!($cursor & self::IN_VARIABLE_NAME)) {
181 181
                     throw new InvalidArgumentException(sprintf(
182
-                        'The route "%s" could not be parsed due to a syntax error. ' .
183
-                        'The attempt to open a variable pattern at position %d failed ' .
182
+                        'The route "%s" could not be parsed due to a syntax error. '.
183
+                        'The attempt to open a variable pattern at position %d failed '.
184 184
                         'because the pattern must be preceded by the variable name.',
185 185
                         $route,
186 186
                         $offset,
187 187
                     ));
188 188
                 }
189 189
 
190
-                $cursor = $cursor & ~self::IN_VARIABLE_NAME | self::IN_VARIABLE_PATTERN;
190
+                $cursor = $cursor & ~self::IN_VARIABLE_NAME|self::IN_VARIABLE_PATTERN;
191 191
                 continue;
192 192
             }
193 193
             if ($route[$offset] === '>' && ($cursor & self::IN_VARIABLE)) {
194 194
                 if (!($cursor & self::IN_VARIABLE_PATTERN)) {
195 195
                     throw new InvalidArgumentException(sprintf(
196
-                        'The route "%s" could not be parsed due to a syntax error. ' .
197
-                        'The attempt to close a variable pattern at position %d failed ' .
196
+                        'The route "%s" could not be parsed due to a syntax error. '.
197
+                        'The attempt to close a variable pattern at position %d failed '.
198 198
                         'because an open pattern was not found.',
199 199
                         $route,
200 200
                         $offset,
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
                 }
203 203
                 if (!isset($variables[$variable]['pattern'])) {
204 204
                     throw new InvalidArgumentException(sprintf(
205
-                        'The route "%s" could not be parsed due to a syntax error. ' .
206
-                        'The attempt to close a variable pattern at position %d failed ' .
205
+                        'The route "%s" could not be parsed due to a syntax error. '.
206
+                        'The attempt to close a variable pattern at position %d failed '.
207 207
                         'because its content is required for its declaration.',
208 208
                         $route,
209 209
                         $offset,
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
             if (($cursor & self::IN_VARIABLE_NAME)) {
231 231
                 if (!isset($variables[$variable]['name']) && $route[$offset] >= '0' && $route[$offset] <= '9') {
232 232
                     throw new InvalidArgumentException(sprintf(
233
-                        'The route "%s" could not be parsed due to a syntax error. ' .
234
-                        'An invalid character was found at position %d. ' .
233
+                        'The route "%s" could not be parsed due to a syntax error. '.
234
+                        'An invalid character was found at position %d. '.
235 235
                         'Please note that variable names cannot start with digits.',
236 236
                         $route,
237 237
                         $offset,
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
                 }
240 240
                 if (!isset(self::PCRE_SUBPATTERN_NAME_CHARSET[$route[$offset]])) {
241 241
                     throw new InvalidArgumentException(sprintf(
242
-                        'The route "%s" could not be parsed due to a syntax error. ' .
243
-                        'An invalid character was found at position %d. ' .
242
+                        'The route "%s" could not be parsed due to a syntax error. '.
243
+                        'An invalid character was found at position %d. '.
244 244
                         'Please note that variable names must consist only of digits, letters and underscores.',
245 245
                         $route,
246 246
                         $offset,
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
                 }
249 249
                 if (isset($variables[$variable]['name'][31])) {
250 250
                     throw new InvalidArgumentException(sprintf(
251
-                        'The route "%s" could not be parsed due to a syntax error. ' .
252
-                        'An extra character was found at position %d. ' .
251
+                        'The route "%s" could not be parsed due to a syntax error. '.
252
+                        'An extra character was found at position %d. '.
253 253
                         'Please note that variable names must not exceed 32 characters.',
254 254
                         $route,
255 255
                         $offset,
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
             if (($cursor & self::IN_VARIABLE_PATTERN)) {
265 265
                 if ($route[$offset] === RouteCompiler::EXPRESSION_DELIMITER) {
266 266
                     throw new InvalidArgumentException(sprintf(
267
-                        'The route "%s" could not be parsed due to a syntax error. ' .
268
-                        'An invalid character was found at position %d. ' .
269
-                        'Please note that variable patterns cannot contain the character "%s"; ' .
267
+                        'The route "%s" could not be parsed due to a syntax error. '.
268
+                        'An invalid character was found at position %d. '.
269
+                        'Please note that variable patterns cannot contain the character "%s"; '.
270 270
                         'use an octal or hexadecimal sequence instead.',
271 271
                         $route,
272 272
                         $offset,
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
             // ~~~~~~~~~^^^~
284 284
             if (($cursor & self::IN_VARIABLE)) {
285 285
                 throw new InvalidArgumentException(sprintf(
286
-                    'The route "%s" could not be parsed due to a syntax error. ' .
287
-                    'An unexpected character was found at position %d; ' .
286
+                    'The route "%s" could not be parsed due to a syntax error. '.
287
+                    'An unexpected character was found at position %d; '.
288 288
                     'a variable at this position must be closed.',
289 289
                     $route,
290 290
                     $offset,
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
 
295 295
         if (($cursor & self::IN_VARIABLE) || ($cursor & self::IN_OPTIONAL_PART)) {
296 296
             throw new InvalidArgumentException(sprintf(
297
-                'The route "%s" could not be parsed due to a syntax error. ' .
298
-                'The attempt to parse the route failed ' .
297
+                'The route "%s" could not be parsed due to a syntax error. '.
298
+                'The attempt to parse the route failed '.
299 299
                 'because it contains an unclosed variable or optional part.',
300 300
                 $route,
301 301
             ));
Please login to merge, or discard this patch.