@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $matchedRoute->argument($key, $urlVariables[$countVars]); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $countVars++; |
|
| 123 | + $countVars ++; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | return $matchedRoute; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $tree = new ExpressionCollection(); |
| 146 | 146 | |
| 147 | 147 | foreach ($expressions as $expression) { |
| 148 | - $name = $names[$namesCount++]; |
|
| 148 | + $name = $names[$namesCount ++]; |
|
| 149 | 149 | |
| 150 | 150 | // Get delimiters and vars: |
| 151 | 151 | [$pattern, $vars] = $this->filterExpression($expression, $captureCount); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $pathVariables = $compiledRoute->getPathVariables(); |
| 189 | 189 | |
| 190 | 190 | if (empty($pathVariables)) { |
| 191 | - $url = \rtrim($route->get('path'), '/') ?: '/'; |
|
| 191 | + $url = \rtrim($route->get('path'), '/') ?: '/'; |
|
| 192 | 192 | |
| 193 | 193 | $this->staticRoutes[$url] = $routeName; |
| 194 | 194 | } else { |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | $pattern = \preg_replace_callback( |
| 224 | 224 | '/\?P<([^>]++)>/', |
| 225 | - static function (array $matches) use (&$modifiers): string { |
|
| 225 | + static function(array $matches) use (&$modifiers): string { |
|
| 226 | 226 | $modifiers[] = $matches[1]; |
| 227 | 227 | |
| 228 | 228 | return ''; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | /x'; |
| 253 | 253 | $pattern = \preg_replace_callback( |
| 254 | 254 | $backref, |
| 255 | - static function (array $m) use ($captureCount): string { |
|
| 255 | + static function(array $m) use ($captureCount): string { |
|
| 256 | 256 | return $m[1] . '\\\\' . ((int) $m[2] + $captureCount); |
| 257 | 257 | }, |
| 258 | 258 | $pattern |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | if ('(' === $prefix[$j]) { |
| 158 | - ++$n; |
|
| 158 | + ++ $n; |
|
| 159 | 159 | } elseif (')' === $prefix[$j]) { |
| 160 | - --$n; |
|
| 161 | - } elseif ('\\' === $prefix[$j] && (++$j === $end || $prefix[$j] !== $anotherPrefix[$j])) { |
|
| 162 | - --$j; |
|
| 160 | + -- $n; |
|
| 161 | + } elseif ('\\' === $prefix[$j] && (++ $j === $end || $prefix[$j] !== $anotherPrefix[$j])) { |
|
| 162 | + -- $j; |
|
| 163 | 163 | |
| 164 | 164 | break; |
| 165 | 165 | } |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | break; |
| 180 | 180 | } |
| 181 | 181 | $i = $j - 1; |
| 182 | - } elseif ('\\' === $prefix[$i] && (++$i === $end || $prefix[$i] !== $anotherPrefix[$i])) { |
|
| 183 | - --$i; |
|
| 182 | + } elseif ('\\' === $prefix[$i] && (++ $i === $end || $prefix[$i] !== $anotherPrefix[$i])) { |
|
| 183 | + -- $i; |
|
| 184 | 184 | |
| 185 | 185 | break; |
| 186 | 186 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | if ($i < $end && 0b10 === (\ord($prefix[$i]) >> 6) && \preg_match('//u', $prefix . ' ' . $anotherPrefix)) { |
| 191 | 191 | do { |
| 192 | 192 | // Prevent cutting in the middle of an UTF-8 characters |
| 193 | - --$i; |
|
| 193 | + -- $i; |
|
| 194 | 194 | } while (0b10 === (\ord($prefix[$i]) >> 6)); |
| 195 | 195 | } |
| 196 | 196 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function match(ServerRequestInterface $request): ?Route |
| 71 | 71 | { |
| 72 | - $resolvedPath = \rawurldecode($this->resolvePath($request)); |
|
| 72 | + $resolvedPath = \rawurldecode($this->resolvePath($request)); |
|
| 73 | 73 | |
| 74 | 74 | // Checks if $route is a static type |
| 75 | 75 | if (isset($this->staticRoutes[$resolvedPath])) { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | if (empty($pathVariables = $compiledRoute->getPathVariables())) { |
| 159 | - $url = \rtrim($route->get('path'), '/') ?: '/'; |
|
| 159 | + $url = \rtrim($route->get('path'), '/') ?: '/'; |
|
| 160 | 160 | |
| 161 | 161 | $this->staticRoutes[$url] = [$index, $matchDomain]; |
| 162 | 162 | |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | $replace = $this->prepareSegment($varName, $rules[$index], $requirements); |
| 354 | 354 | |
| 355 | 355 | // optimize the regex with a possessive quantifier. |
| 356 | - if ($count === 1 && ('/' === $pattern[0] && '+' === $replace[-1])) { |
|
| 356 | + if ($count === 1 && ('/' === $pattern[0] && '+' === $replace[- 1])) { |
|
| 357 | 357 | // This optimization cannot be applied when the next char is no real separator. |
| 358 | 358 | preg_match('#\{.*\}(.+?)#', $pattern, $nextSeperator); |
| 359 | 359 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | $variables[$varName] = !empty($defaults[$index]) ? $defaults[$index] : null; |
| 367 | 367 | |
| 368 | - $count--; |
|
| 368 | + $count --; |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | return [$variables, $replaces]; |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | |
| 66 | 66 | foreach ($value as $k => $v) { |
| 67 | 67 | if ($i === $k) { |
| 68 | - ++$i; |
|
| 68 | + ++ $i; |
|
| 69 | 69 | } else { |
| 70 | 70 | $export .= self::export($k) . ' => '; |
| 71 | 71 | |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | ) { |
| 69 | 69 | $response = $response |
| 70 | 70 | ->withHeader('Pragma', 'no-cache') |
| 71 | - ->withHeader('Expires', (string) -1); |
|
| 71 | + ->withHeader('Expires', (string) - 1); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Redirection headers for 302 and 301 |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | if (!$handler instanceof RequestHandlerInterface) { |
| 241 | 241 | $handler = new RouteHandler( |
| 242 | - function (ServerRequestInterface $request, ResponseInterface $response) use ($route) { |
|
| 242 | + function(ServerRequestInterface $request, ResponseInterface $response) use ($route) { |
|
| 243 | 243 | if (isset($this->options['namespace'])) { |
| 244 | 244 | $this->resolver->setNamespace($this->options['namespace']); |
| 245 | 245 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | return $this->pipeline->process( |
| 324 | 324 | $request, |
| 325 | 325 | new Handlers\CallbackHandler( |
| 326 | - function (ServerRequestInterface $request): ResponseInterface { |
|
| 326 | + function(ServerRequestInterface $request): ResponseInterface { |
|
| 327 | 327 | return $this->responseFactory->createResponse(); |
| 328 | 328 | } |
| 329 | 329 | ) |