Test Failed
Pull Request — master (#16)
by Divine Niiquaye
03:21
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/Matchers/SimpleRouteDumper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
         foreach ($value as $k => $v) {
141 141
             if ($i === $k) {
142
-                ++$i;
142
+                ++ $i;
143 143
             } else {
144 144
                 $export .= self::export($k) . ' => ';
145 145
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         $modifiers = [];
263 263
         $pattern = \preg_replace_callback(
264 264
             '/\?P<(\w+)>/',
265
-            static function (array $matches) use (&$modifiers): string {
265
+            static function(array $matches) use (&$modifiers): string {
266 266
                 $modifiers[] = $matches[1];
267 267
 
268 268
                 return '';
Please login to merge, or discard this patch.
src/Traits/CastingTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             return $route ?: '/';
65 65
         }
66 66
 
67
-        $pattern = \preg_replace_callback(Route::RCA_PATTERN, function (array $matches): string {
67
+        $pattern = \preg_replace_callback(Route::RCA_PATTERN, function(array $matches): string {
68 68
             if (isset($matches[1])) {
69 69
                 $this->schemes[$matches[1]] = true;
70 70
             }
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
             return $uri;
236 236
         }
237 237
 
238
-        if (isset(Route::URL_PREFIX_SLASHES[$prefix[-1]], Route::URL_PREFIX_SLASHES[$uri[0]])) {
238
+        if (isset(Route::URL_PREFIX_SLASHES[$prefix[- 1]], Route::URL_PREFIX_SLASHES[$uri[0]])) {
239 239
             return $prefix . \ltrim($uri, implode('', Route::URL_PREFIX_SLASHES));
240 240
         }
241 241
 
242 242
         // browser supported slashes ...
243
-        $slashExist = Route::URL_PREFIX_SLASHES[$prefix[-1]] ?? Route::URL_PREFIX_SLASHES[$uri[0]] ?? null;
243
+        $slashExist = Route::URL_PREFIX_SLASHES[$prefix[- 1]] ?? Route::URL_PREFIX_SLASHES[$uri[0]] ?? null;
244 244
 
245 245
         if (null === $slashExist) {
246 246
             $prefix .= '/';
Please login to merge, or discard this patch.
src/RouteMatcher.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
             $resolvedPath = $requestUri->getPath();
79 79
         }
80 80
 
81
-        $resolvedPath = \substr($resolvedPath, 0, ('/' !== $resolvedPath && isset(Route::URL_PREFIX_SLASHES[$resolvedPath[-1]])) ? -1 : null);
81
+        $resolvedPath = \substr($resolvedPath, 0, ('/' !== $resolvedPath && isset(Route::URL_PREFIX_SLASHES[$resolvedPath[- 1]])) ? - 1 : null);
82 82
         [$matchedRoute, $matchedDomains, $variables] = $this->matchRoute($resolvedPath = \rawurldecode($resolvedPath));
83 83
 
84 84
         if ($matchedRoute instanceof Route) {
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/Matchers/SimpleRouteCompiler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             $regex = \substr($regex, 1); // returns false for a single character
131 131
         }
132 132
 
133
-        if ('$' === @$regex[-1]) {
133
+        if ('$' === @$regex[- 1]) {
134 134
             $regex = \substr($regex, 0, -1);
135 135
         }
136 136
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         }
159 159
 
160 160
         // Strip supported browser prefix of $uriPattern ...
161
-        if (isset(Route::URL_PREFIX_SLASHES[$uriPattern[-1]])) {
161
+        if (isset(Route::URL_PREFIX_SLASHES[$uriPattern[- 1]])) {
162 162
             $uriPattern = \substr($uriPattern, 0, -1);
163 163
         }
164 164
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
             $hostRegexs[] = \stripslashes($hostRegex);
207 207
         }
208 208
 
209
-        return empty($hostRegexs) ? $compliledHosts . ('|' === $compliledHosts[-1] ? ')' : '') . '$/sDi' : $hostRegexs;
209
+        return empty($hostRegexs) ? $compliledHosts . ('|' === $compliledHosts[- 1] ? ')' : '') . '$/sDi' : $hostRegexs;
210 210
     }
211 211
 
212 212
     /**
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                 $replace = self::SEGMENT_TYPES[$rules[$index]] ?? $rules[$index] ?? $this->prepareSegment($varName, $requirements);
243 243
 
244 244
                 // optimize the regex with a possessive quantifier.
245
-                if (1 === $count && ('/' === $pattern[0] && '+' === @$replace[-1])) {
245
+                if (1 === $count && ('/' === $pattern[0] && '+' === @$replace[- 1])) {
246 246
                     // This optimization cannot be applied when the next char is no real separator.
247 247
                     \preg_match('#\{.*\}(.+?)#', $pattern, $nextSeperator);
248 248
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             $replaces[$placeholders[$index]] = $replace ?? "<$varName>";
256 256
             $variables[$varName] = $defaults[$index] ?? null;
257 257
 
258
-            --$count;
258
+            -- $count;
259 259
         }
260 260
 
261 261
         return [$variables, $replaces];
Please login to merge, or discard this patch.