@@ -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 |
@@ -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 .= '/'; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | // Strip supported browser prefix of $routePath ... |
107 | 107 | if (!empty($routePath)) { |
108 | - $routePath = \rtrim($routePath, Route::URL_PREFIX_SLASHES[$routePath[-1]] ?? '/'); |
|
108 | + $routePath = \rtrim($routePath, Route::URL_PREFIX_SLASHES[$routePath[- 1]] ?? '/'); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | if (!empty($hosts = $route->get('domain'))) { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $regex = \substr($regex, 2); |
220 | 220 | } |
221 | 221 | |
222 | - if ('$' === $regex[-1]) { |
|
222 | + if ('$' === $regex[- 1]) { |
|
223 | 223 | $regex = \substr($regex, 0, -1); |
224 | 224 | } elseif (\strlen($regex) - 2 === \strpos($regex, '\\z')) { |
225 | 225 | $regex = \substr($regex, 0, -2); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | public function match(string $method, UriInterface $uri): ?Route |
85 | 85 | { |
86 | 86 | $pathInfo = $uri->getPath(); |
87 | - $requestPath = \rtrim($pathInfo, Route::URL_PREFIX_SLASHES[$pathInfo[-1]] ?? '/') ?: '/'; |
|
87 | + $requestPath = \rtrim($pathInfo, Route::URL_PREFIX_SLASHES[$pathInfo[- 1]] ?? '/') ?: '/'; |
|
88 | 88 | |
89 | 89 | if (isset($this->staticRouteMap[$requestPath])) { |
90 | 90 | [$routeId, $hostsRegex, $variables] = $this->staticRouteMap[$requestPath]; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $matchVar = 0; |
161 | 161 | |
162 | 162 | foreach ($this->dynamicRouteMap[1][$routeId] ?? [] as $key => $value) { |
163 | - $route->argument($key, $matches[++$matchVar] ?? $value); |
|
163 | + $route->argument($key, $matches[++ $matchVar] ?? $value); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | if (null !== $this->debug) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $route->belong($this); // Attach grouping to route. |
89 | 89 | } |
90 | 90 | |
91 | - ++$this->countRoutes; |
|
91 | + ++ $this->countRoutes; |
|
92 | 92 | |
93 | 93 | return $route; |
94 | 94 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | $this->processRouteMaps($route, $routes->countRoutes, $routes); |
116 | 116 | |
117 | - ++$routes->countRoutes; |
|
117 | + ++ $routes->countRoutes; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | if ($group->offsetExists('group')) { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $name = $route->generateRouteName(''); |
149 | 149 | |
150 | 150 | if (isset($unnamedRoutes[$name])) { |
151 | - $name .= ('_' !== $name[-1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
151 | + $name .= ('_' !== $name[- 1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
152 | 152 | } else { |
153 | 153 | $unnamedRoutes[$name] = 0; |
154 | 154 | } |