Test Failed
Pull Request — master (#16)
by Divine Niiquaye
02:28
created
src/Router.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Routes/FastRoute.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
     public function namespace(string $namespace): self
258 258
     {
259 259
         if ('' !== $namespace) {
260
-            if ('\\' === $namespace[-1]) {
260
+            if ('\\' === $namespace[- 1]) {
261 261
                 throw new InvalidControllerException(\sprintf('Namespace "%s" provided for routes must not end with a "\\".', $namespace));
262 262
             }
263 263
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
             \sprintf('Invalid call for "%s" in %s(\'%1$s\'), try any of [%s].', $name, __METHOD__, \implode(',', \array_keys(static::$getter)))
360 360
         );
361 361
 
362
-        if ('*' === $name[-1]) {
362
+        if ('*' === $name[- 1]) {
363 363
             return \array_unique($this->data[\substr($name, 0, -1)] ?? []);
364 364
         }
365 365
 
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
      */
374 374
     public function getData(): array
375 375
     {
376
-        return \array_map(function (string $property) {
377
-            if ('*' === $property[-1]) {
376
+        return \array_map(function(string $property) {
377
+            if ('*' === $property[- 1]) {
378 378
                 $property = \substr($property, 0, -1);
379 379
             }
380 380
 
Please login to merge, or discard this patch.
src/Routes/Route.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,12 +109,12 @@
 block discarded – undo
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 .= '/';
Please login to merge, or discard this patch.
src/Middlewares/PathMiddleware.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
         $route = $request->getAttribute(Route::class);
70 70
 
71 71
         if ($route instanceof Route) {
72
-            $routeEndTail = BaseRoute::URL_PREFIX_SLASHES[$route->get('path')[-1]] ?? null;
73
-            $requestEndTail = BaseRoute::URL_PREFIX_SLASHES[$trimmedPath[-1]] ?? null;
72
+            $routeEndTail = BaseRoute::URL_PREFIX_SLASHES[$route->get('path')[- 1]] ?? null;
73
+            $requestEndTail = BaseRoute::URL_PREFIX_SLASHES[$trimmedPath[- 1]] ?? null;
74 74
 
75 75
             if ($routeEndTail === $requestEndTail) {
76 76
                 return $response;
@@ -95,6 +95,6 @@  discard block
 block discarded – undo
95 95
 
96 96
     private static function getTrimmedPath(string $requestPath): string
97 97
     {
98
-        return \preg_replace('#(?|\\' . \implode('|\\', BaseRoute::URL_PREFIX_SLASHES) . ')+$#', $requestPath[-1], $requestPath);
98
+        return \preg_replace('#(?|\\' . \implode('|\\', BaseRoute::URL_PREFIX_SLASHES) . ')+$#', $requestPath[- 1], $requestPath);
99 99
     }
100 100
 }
Please login to merge, or discard this patch.
src/RouteMatcher.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     {
97 97
         $requestPath = $uri->getPath();
98 98
 
99
-        if (isset(BaseRoute::URL_PREFIX_SLASHES[$requestPath[-1]])) {
99
+        if (isset(BaseRoute::URL_PREFIX_SLASHES[$requestPath[- 1]])) {
100 100
             $requestPath = \substr($requestPath, 0, -1) ?: '/';
101 101
         }
102 102
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         $routes = $this->routes;
158 158
 
159 159
         if (null !== $this->generatedRegex) {
160
-            \array_walk($routes, static function (&$data): void {
160
+            \array_walk($routes, static function(&$data): void {
161 161
                 $data = $data[0];
162 162
             });
163 163
         }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         }
183 183
 
184 184
         foreach ($variables as $key => $value) {
185
-            $route->argument($key, $matches[++$matchVar] ?? $matches[$key] ?? $hostsVar[$key] ?? $value);
185
+            $route->argument($key, $matches[++ $matchVar] ?? $matches[$key] ?? $hostsVar[$key] ?? $value);
186 186
         }
187 187
 
188 188
         return $route->match($method, $uri);
Please login to merge, or discard this patch.
src/RouteCompiler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/RouteCollection.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -378,11 +378,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                     }
Please login to merge, or discard this patch.