@@ -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 .= '/'; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function match(string $method, UriInterface $uri): ?Route |
74 | 74 | { |
75 | - if ('/' !== ($requestPath = $uri->getPath()) && isset(Route::URL_PREFIX_SLASHES[$requestPath[-1]])) { |
|
75 | + if ('/' !== ($requestPath = $uri->getPath()) && isset(Route::URL_PREFIX_SLASHES[$requestPath[- 1]])) { |
|
76 | 76 | $requestPath = \substr($requestPath, 0, -1); |
77 | 77 | } |
78 | 78 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | foreach ($this->routeMap[2][$routeId] as $key => $value) { |
118 | 118 | $route->argument($key, $matches[$matchVar] ?? $value); |
119 | 119 | |
120 | - ++$matchVar; |
|
120 | + ++ $matchVar; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | return $this->matchRoute($route, $uri); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $route->end($this); |
102 | 102 | } |
103 | 103 | |
104 | - ++$this->countRoutes; |
|
104 | + ++ $this->countRoutes; |
|
105 | 105 | |
106 | 106 | return $route; |
107 | 107 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $routes['staticRouteMap'][$pathRegex] = [$routeId, \array_flip($methods), !empty($hostsRegex) ? '#^(?|' . \implode('|', $hostsRegex) . ')$#i' : null]; |
171 | 171 | } |
172 | 172 | |
173 | - ++$routes['countRoutes']; |
|
173 | + ++ $routes['countRoutes']; |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | private function generateRouteName(Route $route, array $unnamedRoutes): string |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $name = $route->generateRouteName(''); |
180 | 180 | |
181 | 181 | if (isset($unnamedRoutes[$name])) { |
182 | - $name .= ('_' !== $name[-1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
182 | + $name .= ('_' !== $name[- 1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
183 | 183 | } else { |
184 | 184 | $unnamedRoutes[$name] = 0; |
185 | 185 | } |