@@ -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 .= '/'; |
@@ -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 |
@@ -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 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $routes['routes'][] = $route->bind($this->generateRouteName($route, $prefix . $namedGroup, $unnamedRoutes)); |
94 | 94 | $this->processRouteMaps($route, $routes->countRoutes, $routes); |
95 | 95 | |
96 | - ++$routes->countRoutes; |
|
96 | + ++ $routes->countRoutes; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | if ($group->offsetExists('group')) { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $name = $route->generateRouteName(''); |
124 | 124 | |
125 | 125 | if (isset($unnamedRoutes[$name])) { |
126 | - $name .= ('_' !== $name[-1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
126 | + $name .= ('_' !== $name[- 1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
127 | 127 | } else { |
128 | 128 | $unnamedRoutes[$name] = 0; |
129 | 129 | } |
@@ -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 (!empty($staticRoute = $this->staticRouteMap[$requestPath] ?? null)) { |
94 | 94 | $route = $this->routes[$staticRoute[0]]->match($method, $uri); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $matchVar = 0; |
148 | 148 | |
149 | 149 | foreach ($this->dynamicRouteMap[1][$routeId] ?? [] as $key => $value) { |
150 | - $route->argument($key, $matches[++$matchVar] ?? $value); |
|
150 | + $route->argument($key, $matches[++ $matchVar] ?? $value); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return $route->match($method, $uri); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $requirements = $route->get('patterns'); |
104 | 104 | |
105 | 105 | // Strip supported browser prefix of $routePath ... |
106 | - $routePath = \rtrim($routePath = $route->get('path'), Route::URL_PREFIX_SLASHES[$routePath[-1]] ?? '/'); |
|
106 | + $routePath = \rtrim($routePath = $route->get('path'), Route::URL_PREFIX_SLASHES[$routePath[- 1]] ?? '/'); |
|
107 | 107 | |
108 | 108 | if (!empty($routePath) && '/' === $routePath[0]) { |
109 | 109 | $routePath = \substr($routePath, 1); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $regex = \substr($regex, 2); |
208 | 208 | } |
209 | 209 | |
210 | - if ('$' === $regex[-1]) { |
|
210 | + if ('$' === $regex[- 1]) { |
|
211 | 211 | $regex = \substr($regex, 0, -1); |
212 | 212 | } elseif (\strlen($regex) - 2 === \strpos($regex, '\\z')) { |
213 | 213 | $regex = \substr($regex, 0, -2); |