@@ -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; |
@@ -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 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $routePath = \ltrim($route->get('path'), '/'); |
| 102 | 102 | |
| 103 | 103 | // Strip supported browser prefix of $routePath ... |
| 104 | - if (!empty($routePath) && isset(Route::URL_PREFIX_SLASHES[$routePath[-1]])) { |
|
| 104 | + if (!empty($routePath) && isset(Route::URL_PREFIX_SLASHES[$routePath[- 1]])) { |
|
| 105 | 105 | $routePath = \substr($routePath, 0, -1); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $regex = \substr($regex, 2); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - if ('$' === $regex[-1]) { |
|
| 217 | + if ('$' === $regex[- 1]) { |
|
| 218 | 218 | $regex = \substr($regex, 0, -1); |
| 219 | 219 | } elseif (\strlen($regex) - 2 === \strpos($regex, '\\z')) { |
| 220 | 220 | $regex = \substr($regex, 0, -2); |
@@ -215,12 +215,12 @@ |
||
| 215 | 215 | return $uri; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - if (isset(Route::URL_PREFIX_SLASHES[$prefix[-1]], Route::URL_PREFIX_SLASHES[$uri[0]])) { |
|
| 218 | + if (isset(Route::URL_PREFIX_SLASHES[$prefix[- 1]], Route::URL_PREFIX_SLASHES[$uri[0]])) { |
|
| 219 | 219 | return $prefix . \ltrim($uri, \implode('', Route::URL_PREFIX_SLASHES)); |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | // browser supported slashes ... |
| 223 | - $slashExist = Route::URL_PREFIX_SLASHES[$prefix[-1]] ?? Route::URL_PREFIX_SLASHES[$uri[0]] ?? null; |
|
| 223 | + $slashExist = Route::URL_PREFIX_SLASHES[$prefix[- 1]] ?? Route::URL_PREFIX_SLASHES[$uri[0]] ?? null; |
|
| 224 | 224 | |
| 225 | 225 | if (null === $slashExist) { |
| 226 | 226 | $prefix .= '/'; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $route->end($this); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - ++$this->countRoutes; |
|
| 103 | + ++ $this->countRoutes; |
|
| 104 | 104 | |
| 105 | 105 | return $route; |
| 106 | 106 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $pathRegex = $compiledRoute->getPathRegex(); |
| 146 | 146 | |
| 147 | 147 | if (0 === \strpos($pathRegex, '\\/')) { |
| 148 | - $methodsRegex = '(?|' . \implode('|', $methods) .'|([A-Z]+))'; |
|
| 148 | + $methodsRegex = '(?|' . \implode('|', $methods) . '|([A-Z]+))'; |
|
| 149 | 149 | $hostsRegex = empty($hostsRegex) ? '?(?:\\/{2}[^\/]+)?' : '\\/{2}(?i:' . \implode('|', $hostsRegex) . ')'; |
| 150 | 150 | $regex = \preg_replace('/\?(?|P<\w+>|<\w+>|\'\w+\')/', '', $methodsRegex . $hostsRegex . $pathRegex); |
| 151 | 151 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - ++$routes->countRoutes; |
|
| 159 | + ++ $routes->countRoutes; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | private function generateRouteName(Route $route, array $unnamedRoutes): string |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $name = $route->generateRouteName(''); |
| 166 | 166 | |
| 167 | 167 | if (isset($unnamedRoutes[$name])) { |
| 168 | - $name .= ('_' !== $name[-1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
| 168 | + $name .= ('_' !== $name[- 1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
| 169 | 169 | } else { |
| 170 | 170 | $unnamedRoutes[$name] = 0; |
| 171 | 171 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | $requestPath = $uri->getPath(); |
| 87 | 87 | |
| 88 | - if ('/' !== $requestPath && isset(Route::URL_PREFIX_SLASHES[$requestPath[-1]])) { |
|
| 88 | + if ('/' !== $requestPath && isset(Route::URL_PREFIX_SLASHES[$requestPath[- 1]])) { |
|
| 89 | 89 | $uri = $uri->withPath($requestPath = \substr($requestPath, 0, -1)); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | foreach ($variables as $key => $value) { |
| 173 | 173 | $route->argument($key, $allowed[$matchVar] ?? $value); |
| 174 | 174 | |
| 175 | - ++$matchVar; |
|
| 175 | + ++ $matchVar; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | if (null !== $this->debug) { |