@@ -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); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $route->belong($this); // Attach grouping to route. |
71 | 71 | } |
72 | 72 | |
73 | - ++$this->countRoutes; |
|
73 | + ++ $this->countRoutes; |
|
74 | 74 | |
75 | 75 | return $route; |
76 | 76 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $routes['routes'][] = $route->bind($this->generateRouteName($route, $prefix, $unnamedRoutes)); |
92 | 92 | $this->processRouteMaps($route, $routes->countRoutes, $routes); |
93 | 93 | |
94 | - ++$routes->countRoutes; |
|
94 | + ++ $routes->countRoutes; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | if ($group->offsetExists('group')) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $name = $route->generateRouteName(''); |
128 | 128 | |
129 | 129 | if (isset($unnamedRoutes[$name])) { |
130 | - $name .= ('_' !== $name[-1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
130 | + $name .= ('_' !== $name[- 1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
131 | 131 | } else { |
132 | 132 | $unnamedRoutes[$name] = 0; |
133 | 133 | } |
@@ -109,7 +109,7 @@ |
||
109 | 109 | */ |
110 | 110 | public function setCollection(callable $routeDefinitionCallback, $routeCollector = RouteCollection::class): void |
111 | 111 | { |
112 | - $this->collection = static function () use ($routeDefinitionCallback, $routeCollector): RouteMapInterface { |
|
112 | + $this->collection = static function() use ($routeDefinitionCallback, $routeCollector): RouteMapInterface { |
|
113 | 113 | $routeCollector = new $routeCollector(); |
114 | 114 | \assert($routeCollector instanceof RouteMapInterface); |
115 | 115 |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function match(string $method, UriInterface $uri): ?Route |
90 | 90 | { |
91 | - $requestPath = \rtrim($pathInfo = $uri->getPath(), Route::URL_PREFIX_SLASHES[$pathInfo[-1]] ?? '/') ?: '/'; |
|
91 | + $requestPath = \rtrim($pathInfo = $uri->getPath(), Route::URL_PREFIX_SLASHES[$pathInfo[- 1]] ?? '/') ?: '/'; |
|
92 | 92 | |
93 | 93 | if (isset($this->staticRouteMap[$requestPath])) { |
94 | 94 | [$routeId, $hostsRegex, $variables] = $this->staticRouteMap[$requestPath]; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $matchVar = 0; |
156 | 156 | |
157 | 157 | foreach ($this->dynamicRouteMap[1][$routeId] ?? [] as $key => $value) { |
158 | - $route->argument($key, $matches[++$matchVar] ?? $value); |
|
158 | + $route->argument($key, $matches[++ $matchVar] ?? $value); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | return $route->match($method, $uri); |