Test Failed
Push — master ( e661e2...8d0a2c )
by Dan
06:05 queued 12s
created
Src/Router/Dispatcher/Dispatcher.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     /**
183 183
      * Reflect Controller construct and get parameters.
184 184
      *
185
-     * @param $controllerName
185
+     * @param string $controllerName
186 186
      * @internal
187 187
      *
188 188
      * @return \ReflectionParameter[]
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
     /**
309 309
      * Checks controller instance against whitelist.
310 310
      *
311
-     * @param $controller
311
+     * @param string $controller
312 312
      * @param $options
313 313
      * @throws DispatchException
314 314
      */
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
     /**
343 343
      * Checks controller instance against blacklist.
344 344
      *
345
-     * @param $controller
345
+     * @param string $controller
346 346
      * @param $options
347 347
      * @throws DispatchException
348 348
      */
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
     /**
375 375
      * With Class Namespace.
376 376
      *
377
-     * @param $namespace
377
+     * @param string $namespace
378 378
      * @return Dispatcher
379 379
      */
380 380
     public function withNamespace($namespace)
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
     /**
388 388
      * With class Namespaces.
389 389
      *
390
-     * @param array $namespaces
390
+     * @param string[] $namespaces
391 391
      * @return Dispatcher
392 392
      */
393 393
     public function withNamespaces(array $namespaces)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             case 'string':
84 84
 
85 85
                 $params = \explode($this->options['stringHandlerPattern'], $handler);
86
-                if (!isset($params[1])){
86
+                if (!isset($params[1])) {
87 87
                     $response = $handler;
88 88
                     break;
89 89
                 }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
         try {
126 126
             $resolvedHandler['controller'] = $this->_findClass($controllerMethod[0]);
127
-        } catch (\Exception $e) {
127
+        }catch (\Exception $e) {
128 128
             throw new DispatchException($e->getMessage());
129 129
         }
130 130
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
         try {
177 177
             $this->_getParamsFromVariableName($args);
178
-        } catch (\Exception $e) {
178
+        }catch (\Exception $e) {
179 179
             $this->_getParamsFromTypeHint($args);
180 180
         }
181 181
 
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
     protected function _callController(ServerRequestInterface $request, string $controller, string $method)
298 298
     {
299 299
 
300
-        if (!class_exists($controller)){
301
-            throw new DispatchException('Unable to locate controller: '.$controller);
300
+        if (!class_exists($controller)) {
301
+            throw new DispatchException('Unable to locate controller: ' . $controller);
302 302
         }
303 303
 
304 304
         $controllerObj = new $controller(...$this->providedArguments);
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
         try {
307 307
             $this->_checkWhiteList($controller, $this->options);
308 308
             $this->_checkBlackList($controller, $this->options);
309
-        } catch (\Exception $e) {
309
+        }catch (\Exception $e) {
310 310
             unset($controllerObj);
311 311
             throw new DispatchException($e->getMessage());
312 312
         }
313 313
 
314
-        if (!method_exists($controllerObj,$method)){
315
-            throw new DispatchException('Unable to locate method: '.$controller.'::'.$method);
314
+        if (!method_exists($controllerObj, $method)) {
315
+            throw new DispatchException('Unable to locate method: ' . $controller . '::' . $method);
316 316
         }
317 317
 
318 318
         return $controllerObj->{$method}($request);
Please login to merge, or discard this patch.
Example/Routes/routes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 $collection->addRoute('GET', '/path', 'myClass::myMethod', ['name']);
29 29
 $collection->addRoute('GET', '/another', 'another-handler', ['name']);
30 30
 
31
-$collection->group('/newPath', function () use ($collection, $something) {
31
+$collection->group('/newPath', function() use ($collection, $something) {
32 32
 
33 33
     //Add both POST and GET routes with Closure.
34
-    $collection->addRoute(['GET', 'POST'], '/new', function ($request) use ($something) {
34
+    $collection->addRoute(['GET', 'POST'], '/new', function($request) use ($something) {
35 35
         return $something;
36 36
     }, ['name']);
37 37
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
 $collection->addRoute('GET', '/mypath', 'handler::string', ['name']);
41 41
 
42
-$collection->addRoute('GET', '/someproduct', function ($request) {
42
+$collection->addRoute('GET', '/someproduct', function($request) {
43 43
     return 'this is my response for ';
44 44
 }, ['name']);
45 45
 
Please login to merge, or discard this patch.
Tests/Router/Serializer/SuperClosureTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
      */
37 37
     public function testSerializeCalled()
38 38
     {
39
-        $data = function () {
39
+        $data = function() {
40 40
             return true;
41 41
         };
42 42
 
Please login to merge, or discard this patch.
Tests/Router/RouterResponseTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
     {
44 44
         $this->handler = 'handler';
45 45
         $this->code = 200;
46
-        $this->names = ['name','name2'];
46
+        $this->names = ['name', 'name2'];
47 47
         $this->vars = ['a' => 1, 'b' =>2];
48 48
         $this->routerResponse = new RouterResponse($this->code, $this->handler, $this->names, $this->vars);
49 49
     }
Please login to merge, or discard this patch.
Tests/Router/Loaders/Files/FileLoaderRoutesAlt.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 $collection = new \Ds\Router\RouteCollection();
8 8
 
9
-$collection->addRoute('GET', '/pathalt', function () use ($variable) {
9
+$collection->addRoute('GET', '/pathalt', function() use ($variable) {
10 10
     return $variable;
11 11
 }, ['name']);
12 12
 
Please login to merge, or discard this patch.
Tests/Router/Loaders/Files/FileLoaderRoutes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 $collection = new \Ds\Router\RouteCollection();
8 8
 
9
-$collection->addRoute('GET', '/path', function () use ($variable) {
9
+$collection->addRoute('GET', '/path', function() use ($variable) {
10 10
     return $variable;
11 11
 }, ['name']);
12 12
 
Please login to merge, or discard this patch.
Tests/Router/RouteTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     /**
36 36
      * @var array
37 37
      */
38
-    protected $expectedNames = ['name-1','name-2'];
38
+    protected $expectedNames = ['name-1', 'name-2'];
39 39
 
40 40
     /**
41 41
      * Route setUp.
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function testWithNames()
83 83
     {
84
-        $expected = ['foo','bar','baz'];
84
+        $expected = ['foo', 'bar', 'baz'];
85 85
         $route = $this->route->withNames($expected);
86 86
         $this->assertSame(
87 87
             $expected,
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function testWithHandlerClosure()
110 110
     {
111
-        $expected = function () {
111
+        $expected = function() {
112 112
             return 'closure';
113 113
         };
114 114
         $route = $this->route->withHandler($expected);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function testGetHandlerTypeClosure()
154 154
     {
155
-        $closure = function () {
155
+        $closure = function() {
156 156
         };
157 157
         $expected = 'object';
158 158
         $route = $this->route->withHandler($closure);
Please login to merge, or discard this patch.
Src/Router/Loaders/YamlLoader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
                         $collection->addRoute($routeMethod, $route['path'], $route['handler'], $route['names']);
69 69
                     }
70 70
                 }
71
-            } catch (ParseException $e) {
71
+            }catch (ParseException $e) {
72 72
                 throw new RouterException($e->getMessage());
73 73
             }
74 74
 
Please login to merge, or discard this patch.
Tests/Router/RouteCollectionTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
     {
34 34
         $handler = 'my-handler';
35 35
         $routes = $this->collection;
36
-        $routes->group('/path', function () use ($routes, $handler) {
36
+        $routes->group('/path', function() use ($routes, $handler) {
37 37
             $routes->addRoute(['GET', 'POST'], '/foo', $handler, ['global']);
38
-            $routes->group('/sub-dir', function () use ($routes, $handler) {
38
+            $routes->group('/sub-dir', function() use ($routes, $handler) {
39 39
                 $routes->addRoute(['GET'], '/sub-page', $handler, ['sub-dir']);
40 40
             });
41 41
         });
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     public function testMergeCollection()
176 176
     {
177 177
         $handler = 'handler::string';
178
-        $names = ['routes','names'];
178
+        $names = ['routes', 'names'];
179 179
         $collection = new RouteCollection();
180 180
         $collection->addRoute('GET', '/path', $handler, $names);
181 181
         $collection->addRoute('GET', '/another', $handler, $names);
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     {
195 195
         $this->setExpectedException(RouteException::class);
196 196
         $handler = 'handler::string';
197
-        $names = ['routes','names'];
197
+        $names = ['routes', 'names'];
198 198
         $collection = new RouteCollection();
199 199
         $collection->addRoute('GET', '/path', $handler, $names);
200 200
         $collection->addRoute('GET', '/another', $handler, $names);
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
      */
246 246
     public function testMergeGroupNames()
247 247
     {
248
-        $expected = ['route-name','group-name'];
248
+        $expected = ['route-name', 'group-name'];
249 249
         $handler = 'myhandler';
250 250
         $routes = $this->collection;
251 251
 
252
-        $routes->group('/path', function () use ($routes, $handler) {
252
+        $routes->group('/path', function() use ($routes, $handler) {
253 253
             $routes->addRoute(['GET', 'POST'], '/foo', $handler, ['route-name']);
254 254
         }, ['group-name']);
255 255
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     /**
261 261
      * Test that the namespace is matched to the handler and returned.
262 262
      */
263
-    public function testFindHandlerNamespace(){
263
+    public function testFindHandlerNamespace() {
264 264
 
265 265
         $routeCollection = new RouteCollection();
266 266
         $routeCollection->addNamespace('\Rs\Router');
@@ -272,13 +272,13 @@  discard block
 block discarded – undo
272 272
         $reflectionMethod->setAccessible(true);
273 273
         $actual = $reflectionMethod->invoke($routeCollection, $handler);
274 274
 
275
-        $this->assertEquals($expected,$actual);
275
+        $this->assertEquals($expected, $actual);
276 276
     }
277 277
 
278 278
     /**
279 279
      * Test that backlash is added to start of namespace on response.
280 280
      */
281
-    public function testFindHandlerNamespaceNoBacklash(){
281
+    public function testFindHandlerNamespaceNoBacklash() {
282 282
 
283 283
         $routeCollection = new RouteCollection();
284 284
         $routeCollection->addNamespace('Rs\Router');
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         $reflectionMethod->setAccessible(true);
291 291
         $actual = $reflectionMethod->invoke($routeCollection, $handler);
292 292
 
293
-        $this->assertEquals($expected,$actual);
293
+        $this->assertEquals($expected, $actual);
294 294
     }
295 295
 
296 296
 }
Please login to merge, or discard this patch.