@@ -109,12 +109,12 @@ |
||
109 | 109 | return $uri; |
110 | 110 | } |
111 | 111 | |
112 | - if (isset(self::URL_PREFIX_SLASHES[$prefix[-1]], self::URL_PREFIX_SLASHES[$uri[0]])) { |
|
112 | + if (isset(self::URL_PREFIX_SLASHES[$prefix[- 1]], self::URL_PREFIX_SLASHES[$uri[0]])) { |
|
113 | 113 | return $prefix . \ltrim($uri, \implode('', self::URL_PREFIX_SLASHES)); |
114 | 114 | } |
115 | 115 | |
116 | 116 | // browser supported slashes ... |
117 | - $slashExist = self::URL_PREFIX_SLASHES[$prefix[-1]] ?? self::URL_PREFIX_SLASHES[$uri[0]] ?? null; |
|
117 | + $slashExist = self::URL_PREFIX_SLASHES[$prefix[- 1]] ?? self::URL_PREFIX_SLASHES[$uri[0]] ?? null; |
|
118 | 118 | |
119 | 119 | if (null === $slashExist) { |
120 | 120 | $prefix .= '/'; |
@@ -155,11 +155,11 @@ discard block |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | if ('(' === $prefix[$j]) { |
158 | - ++$n; |
|
158 | + ++ $n; |
|
159 | 159 | } elseif (')' === $prefix[$j]) { |
160 | - --$n; |
|
161 | - } elseif ('\\' === $prefix[$j] && (++$j === $end || $prefix[$j] !== $anotherPrefix[$j])) { |
|
162 | - --$j; |
|
160 | + -- $n; |
|
161 | + } elseif ('\\' === $prefix[$j] && (++ $j === $end || $prefix[$j] !== $anotherPrefix[$j])) { |
|
162 | + -- $j; |
|
163 | 163 | |
164 | 164 | break; |
165 | 165 | } |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | break; |
180 | 180 | } |
181 | 181 | $i = $j - 1; |
182 | - } elseif ('\\' === $prefix[$i] && (++$i === $end || $prefix[$i] !== $anotherPrefix[$i])) { |
|
183 | - --$i; |
|
182 | + } elseif ('\\' === $prefix[$i] && (++ $i === $end || $prefix[$i] !== $anotherPrefix[$i])) { |
|
183 | + -- $i; |
|
184 | 184 | |
185 | 185 | break; |
186 | 186 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | if ($i < $end && 0b10 === (\ord($prefix[$i]) >> 6) && \preg_match('//u', $prefix . ' ' . $anotherPrefix)) { |
191 | 191 | do { |
192 | 192 | // Prevent cutting in the middle of an UTF-8 characters |
193 | - --$i; |
|
193 | + -- $i; |
|
194 | 194 | } while (0b10 === (\ord($prefix[$i]) >> 6)); |
195 | 195 | } |
196 | 196 |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $variables = []; // The vars found in path and hosts regex. |
111 | 111 | |
112 | 112 | // Strip supported browser prefix of $routePath ... |
113 | - if (isset(BaseRoute::URL_PREFIX_SLASHES[@$routePath[-1]])) { |
|
113 | + if (isset(BaseRoute::URL_PREFIX_SLASHES[@$routePath[- 1]])) { |
|
114 | 114 | $routePath = \substr($routePath, 0, -1); |
115 | 115 | } |
116 | 116 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | return \implode('|', \array_map( |
328 | - static function (string $segment) use ($name): string { |
|
328 | + static function(string $segment) use ($name): string { |
|
329 | 329 | return self::sanitizeRequirement($name, $segment); |
330 | 330 | }, |
331 | 331 | $segment |
@@ -378,11 +378,11 @@ discard block |
||
378 | 378 | { |
379 | 379 | $sortRegex = '#^[\w+' . \implode('\\', Routes\Route::URL_PREFIX_SLASHES) . ']+$#'; |
380 | 380 | |
381 | - \usort($routes, static function (Routes\FastRoute $a, Routes\FastRoute $b) use ($sortRegex): int { |
|
381 | + \usort($routes, static function(Routes\FastRoute $a, Routes\FastRoute $b) use ($sortRegex): int { |
|
382 | 382 | $aRegex = \preg_match($sortRegex, $a->get('path')); |
383 | 383 | $bRegex = \preg_match($sortRegex, $b->get('path')); |
384 | 384 | |
385 | - return $aRegex == $bRegex ? 0 : ($aRegex < $bRegex ? +1 : -1); |
|
385 | + return $aRegex == $bRegex ? 0 : ($aRegex < $bRegex ? + 1 : -1); |
|
386 | 386 | }); |
387 | 387 | |
388 | 388 | return $routes; |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $name = $route->generateRouteName(''); |
434 | 434 | |
435 | 435 | if (isset($unnamedRoutes[$name])) { |
436 | - $name .= ('_' !== $name[-1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
436 | + $name .= ('_' !== $name[- 1] ? '_' : '') . ++$unnamedRoutes[$name]; |
|
437 | 437 | } else { |
438 | 438 | $unnamedRoutes[$name] = 0; |
439 | 439 | } |
@@ -65,8 +65,8 @@ |
||
65 | 65 | // Determine the response code should keep HTTP request method ... |
66 | 66 | $statusCode = $this->keepRequestMethod ? ($this->permanent ? 308 : 307) : ($this->permanent ? 301 : 302); |
67 | 67 | |
68 | - $routeEndTail = BaseRoute::URL_PREFIX_SLASHES[$route->get('path')[-1]] ?? null; |
|
69 | - $requestEndTail = BaseRoute::URL_PREFIX_SLASHES[$requestPath[-1]] ?? null; |
|
68 | + $routeEndTail = BaseRoute::URL_PREFIX_SLASHES[$route->get('path')[- 1]] ?? null; |
|
69 | + $requestEndTail = BaseRoute::URL_PREFIX_SLASHES[$requestPath[- 1]] ?? null; |
|
70 | 70 | |
71 | 71 | if ($routeEndTail === $requestEndTail) { |
72 | 72 | return $response; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function setCollection(callable $routeDefinitionCallback): void |
151 | 151 | { |
152 | - $this->collection = static function () use ($routeDefinitionCallback): RouteCollection { |
|
152 | + $this->collection = static function() use ($routeDefinitionCallback): RouteCollection { |
|
153 | 153 | $routeDefinitionCallback($routeCollector = new RouteCollection()); |
154 | 154 | |
155 | 155 | return $routeCollector; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | if ($collection instanceof RouteCollection) { |
181 | - $collection = static function () use ($collection): RouteCollection { |
|
181 | + $collection = static function() use ($collection): RouteCollection { |
|
182 | 182 | return $collection; |
183 | 183 | }; |
184 | 184 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | $requestPath = $uri->getPath(); |
98 | 98 | |
99 | - if (\array_key_exists($requestPath[-1], BaseRoute::URL_PREFIX_SLASHES)) { |
|
99 | + if (\array_key_exists($requestPath[- 1], BaseRoute::URL_PREFIX_SLASHES)) { |
|
100 | 100 | $requestPath = \substr($requestPath, 0, -1) ?: '/'; |
101 | 101 | } |
102 | 102 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $routes = $this->routes; |
159 | 159 | |
160 | 160 | if (null !== $this->generatedRegex) { |
161 | - \array_walk($routes, static function (&$data): void { |
|
161 | + \array_walk($routes, static function(&$data): void { |
|
162 | 162 | $data = $data[0]; |
163 | 163 | }); |
164 | 164 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | foreach ($variables as $key => $value) { |
186 | - $route->argument($key, $matches[++$matchVar] ?? $matches[$key] ?? $hostsVar[$key] ?? $value); |
|
186 | + $route->argument($key, $matches[++ $matchVar] ?? $matches[$key] ?? $hostsVar[$key] ?? $value); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | return $route->match($method, $uri); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | public function namespace(string $namespace) |
283 | 283 | { |
284 | 284 | if ('' !== $namespace) { |
285 | - if ('\\' === $namespace[-1]) { |
|
285 | + if ('\\' === $namespace[- 1]) { |
|
286 | 286 | throw new InvalidControllerException(\sprintf('Namespace "%s" provided for routes must not end with a "\\".', $namespace)); |
287 | 287 | } |
288 | 288 | |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | throw new \InvalidArgumentException(\sprintf('Invalid call for "%s" in %s(\'%1$s\'), try any of [%s].', $name, __METHOD__, \implode(',', \array_keys(static::$getter)))); |
407 | 407 | } |
408 | 408 | |
409 | - if ('*' === $key[-1]) { |
|
409 | + if ('*' === $key[- 1]) { |
|
410 | 410 | return \array_unique($this->data[\substr($key, 0, -1)] ?? []); |
411 | 411 | } |
412 | 412 | |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | */ |
431 | 431 | public function getData(): array |
432 | 432 | { |
433 | - return \array_map(function (string $property) { |
|
434 | - if ('*' === $property[-1]) { |
|
433 | + return \array_map(function(string $property) { |
|
434 | + if ('*' === $property[- 1]) { |
|
435 | 435 | $property = \substr($property, 0, -1); |
436 | 436 | } |
437 | 437 |