@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $requestUri = $request->getUri(); |
| 61 | 61 | $response = $handler->handle($request); |
| 62 | - $requestPath = \preg_replace($prefixRegex, $requestUri->getPath()[-1], $requestUri->getPath()); |
|
| 62 | + $requestPath = \preg_replace($prefixRegex, $requestUri->getPath()[- 1], $requestUri->getPath()); |
|
| 63 | 63 | |
| 64 | 64 | // Determine the response code should keep HTTP request method ... |
| 65 | 65 | $statusCode = $this->keepRequestMethod ? ($this->permanent ? 308 : 307) : ($this->permanent ? 301 : 302); |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | $route = $request->getAttribute(Route::class); |
| 72 | 72 | |
| 73 | 73 | if ($route instanceof Route) { |
| 74 | - $routeEndTail = Route::URL_PREFIX_SLASHES[$route->get('path')[-1]] ?? null; |
|
| 75 | - $requestEndTail = Route::URL_PREFIX_SLASHES[$requestPath[-1]] ?? null; |
|
| 74 | + $routeEndTail = Route::URL_PREFIX_SLASHES[$route->get('path')[- 1]] ?? null; |
|
| 75 | + $requestEndTail = Route::URL_PREFIX_SLASHES[$requestPath[- 1]] ?? null; |
|
| 76 | 76 | |
| 77 | 77 | if ($routeEndTail === $requestEndTail) { |
| 78 | 78 | return $response; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | foreach ($value as $k => $v) { |
| 141 | 141 | if ($i === $k) { |
| 142 | - ++$i; |
|
| 142 | + ++ $i; |
|
| 143 | 143 | } else { |
| 144 | 144 | $export .= self::export($k) . ' => '; |
| 145 | 145 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $modifiers = []; |
| 263 | 263 | $pattern = \preg_replace_callback( |
| 264 | 264 | '/\?P<(\w+)>/', |
| 265 | - static function (array $matches) use (&$modifiers): string { |
|
| 265 | + static function(array $matches) use (&$modifiers): string { |
|
| 266 | 266 | $modifiers[] = $matches[1]; |
| 267 | 267 | |
| 268 | 268 | return ''; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | return $route ?: '/'; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $pattern = \preg_replace_callback(Route::RCA_PATTERN, function (array $matches): string { |
|
| 67 | + $pattern = \preg_replace_callback(Route::RCA_PATTERN, function(array $matches): string { |
|
| 68 | 68 | if (isset($matches[1])) { |
| 69 | 69 | $this->schemes[$matches[1]] = true; |
| 70 | 70 | } |
@@ -235,12 +235,12 @@ discard block |
||
| 235 | 235 | return $uri; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - if (isset(Route::URL_PREFIX_SLASHES[$prefix[-1]], Route::URL_PREFIX_SLASHES[$uri[0]])) { |
|
| 238 | + if (isset(Route::URL_PREFIX_SLASHES[$prefix[- 1]], Route::URL_PREFIX_SLASHES[$uri[0]])) { |
|
| 239 | 239 | return $prefix . \ltrim($uri, implode('', Route::URL_PREFIX_SLASHES)); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // browser supported slashes ... |
| 243 | - $slashExist = Route::URL_PREFIX_SLASHES[$prefix[-1]] ?? Route::URL_PREFIX_SLASHES[$uri[0]] ?? null; |
|
| 243 | + $slashExist = Route::URL_PREFIX_SLASHES[$prefix[- 1]] ?? Route::URL_PREFIX_SLASHES[$uri[0]] ?? null; |
|
| 244 | 244 | |
| 245 | 245 | if (null === $slashExist) { |
| 246 | 246 | $prefix .= '/'; |
@@ -206,7 +206,7 @@ |
||
| 206 | 206 | public function namespace(string $namespace): self |
| 207 | 207 | { |
| 208 | 208 | if ('' !== $namespace) { |
| 209 | - if ('\\' === $namespace[-1]) { |
|
| 209 | + if ('\\' === $namespace[- 1]) { |
|
| 210 | 210 | throw new InvalidControllerException(\sprintf('Namespace "%s" provided for routes must not end with a "\\".', $namespace)); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | $resolvedPath = $requestUri->getPath(); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if ('/' !== $resolvedPath && isset(Route::URL_PREFIX_SLASHES[$resolvedPath[-1]])) { |
|
| 79 | + if ('/' !== $resolvedPath && isset(Route::URL_PREFIX_SLASHES[$resolvedPath[- 1]])) { |
|
| 80 | 80 | $resolvedPath = \substr($resolvedPath, 0, -1); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $regex = \substr($regex, 1); // returns false for a single character |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if ('$' === @$regex[-1]) { |
|
| 133 | + if ('$' === @$regex[- 1]) { |
|
| 134 | 134 | $regex = \substr($regex, 0, -1); |
| 135 | 135 | } |
| 136 | 136 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | // Strip supported browser prefix of $uriPattern ... |
| 161 | - if (isset(Route::URL_PREFIX_SLASHES[$uriPattern[-1]])) { |
|
| 161 | + if (isset(Route::URL_PREFIX_SLASHES[$uriPattern[- 1]])) { |
|
| 162 | 162 | $uriPattern = \substr($uriPattern, 0, -1); |
| 163 | 163 | } |
| 164 | 164 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $hostRegexps[] = \stripslashes($hostRegex); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - return empty($hostRegexps) ? $compliedHosts . ('|' === $compliedHosts[-1] ? ')' : '') . '$/sDi' : $hostRegexps; |
|
| 209 | + return empty($hostRegexps) ? $compliedHosts . ('|' === $compliedHosts[- 1] ? ')' : '') . '$/sDi' : $hostRegexps; |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $replace = self::SEGMENT_TYPES[$rules[$index]] ?? $rules[$index] ?? $this->prepareSegment($varName, $requirements); |
| 243 | 243 | |
| 244 | 244 | // optimize the regex with a possessive quantifier. |
| 245 | - if (1 === $count && ('/' === $pattern[0] && '+' === @$replace[-1])) { |
|
| 245 | + if (1 === $count && ('/' === $pattern[0] && '+' === @$replace[- 1])) { |
|
| 246 | 246 | // This optimization cannot be applied when the next char is no real separator. |
| 247 | 247 | \preg_match('#\{.*\}(.+?)#', $pattern, $nextSeparator); |
| 248 | 248 | |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $replaces[$placeholders[$index]] = $replace ?? "<$varName>"; |
| 256 | 256 | $variables[$varName] = $defaults[$index] ?? null; |
| 257 | 257 | |
| 258 | - --$count; |
|
| 258 | + -- $count; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | return [$variables, $replaces]; |