Test Failed
Pull Request — master (#16)
by Divine Niiquaye
02:37
created
src/Middlewares/PathMiddleware.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Route.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -206,7 +206,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Traits/CastingTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -215,12 +215,12 @@
 block discarded – undo
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 .= '/';
Please login to merge, or discard this patch.
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/Traits/GroupingTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/RouteMatcher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
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
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.