Test Failed
Pull Request — master (#16)
by Divine Niiquaye
13:18
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/SimpleRouteCompiler.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             $regex = \substr($regex, 1); // returns false for a single character
126 126
         }
127 127
 
128
-        if ('$' === @$regex[-1]) {
128
+        if ('$' === @$regex[- 1]) {
129 129
             $regex = \substr($regex, 0, -1);
130 130
         }
131 131
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         }
158 158
 
159 159
         if (!$isHost) {
160
-            $uriPattern = '/' . \substr($uriPattern, 0, isset(Route::URL_PREFIX_SLASHES[$uriPattern[-1]]) ? -1 : null);
160
+            $uriPattern = '/' . \substr($uriPattern, 0, isset(Route::URL_PREFIX_SLASHES[$uriPattern[- 1]]) ? - 1 : null);
161 161
         }
162 162
 
163 163
         // Match all variables enclosed in "{}" and iterate over them...
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
                 $replace = self::SEGMENT_TYPES[$rules[$index]] ?? $rules[$index] ?? $this->prepareSegment($varName, $requirements);
206 206
 
207 207
                 // optimize the regex with a possessive quantifier.
208
-                if (1 === $count && ('/' === $pattern[0] && '+' === @$replace[-1])) {
208
+                if (1 === $count && ('/' === $pattern[0] && '+' === @$replace[- 1])) {
209 209
                     // This optimization cannot be applied when the next char is no real separator.
210 210
                     \preg_match('#\{.*\}(.+?)#', $pattern, $nextSeperator);
211 211
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
             $replaces[$placeholders[$index]] = $replace ?? "<$varName>";
219 219
             $variables[$varName] = $defaults[$index] ?? null;
220 220
 
221
-            --$count;
221
+            -- $count;
222 222
         }
223 223
 
224 224
         return [$variables, $replaces];
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.