@@ -182,7 +182,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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) |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | try { |
| 118 | 118 | $resolvedHandler['controller'] = $this->_findClass($controllerMethod[0]); |
| 119 | - } catch (\Exception $e) { |
|
| 119 | + }catch (\Exception $e) { |
|
| 120 | 120 | throw new DispatchException($e->getMessage()); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | try { |
| 169 | 169 | $this->_getParamsFromVariableName($args); |
| 170 | - } catch (\Exception $e) { |
|
| 170 | + }catch (\Exception $e) { |
|
| 171 | 171 | $this->_getParamsFromTypeHint($args); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -293,12 +293,12 @@ discard block |
||
| 293 | 293 | try { |
| 294 | 294 | $this->_checkWhiteList($controller, $this->options); |
| 295 | 295 | $this->_checkBlackList($controller, $this->options); |
| 296 | - } catch (\Exception $e) { |
|
| 296 | + }catch (\Exception $e) { |
|
| 297 | 297 | unset($controllerObj); |
| 298 | 298 | throw new DispatchException($e->getMessage()); |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - if (!method_exists($controllerObj,$method)){ |
|
| 301 | + if (!method_exists($controllerObj, $method)) { |
|
| 302 | 302 | throw new DispatchException('Controller method does not exist'); |
| 303 | 303 | } |
| 304 | 304 | |
@@ -28,10 +28,10 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -33,9 +33,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -248,11 +248,11 @@ discard block |
||
| 248 | 248 | */ |
| 249 | 249 | public function testMergeGroupNames() |
| 250 | 250 | { |
| 251 | - $expected = ['route-name','group-name']; |
|
| 251 | + $expected = ['route-name', 'group-name']; |
|
| 252 | 252 | $handler = 'myhandler'; |
| 253 | 253 | $routes = $this->collection; |
| 254 | 254 | |
| 255 | - $routes->group('/path', function () use ($routes, $handler) { |
|
| 255 | + $routes->group('/path', function() use ($routes, $handler) { |
|
| 256 | 256 | $routes->addRoute(['GET', 'POST'], '/foo', $handler, ['route-name']); |
| 257 | 257 | }, ['group-name']); |
| 258 | 258 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | public function testSerializeCalled() |
| 38 | 38 | { |
| 39 | - $data = function () { |
|
| 39 | + $data = function() { |
|
| 40 | 40 | return true; |
| 41 | 41 | }; |
| 42 | 42 | |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | */ |
| 70 | 70 | public function testGetRouterResponse() |
| 71 | 71 | { |
| 72 | - $request = $this->getMockBuilder(ServerRequestInterface::class)->getMock(); |
|
| 72 | + $request = $this->getMockBuilder(ServerRequestInterface::class)->getMock(); |
|
| 73 | 73 | |
| 74 | 74 | $method = 'GET'; |
| 75 | 75 | $path = '/path'; |
@@ -43,7 +43,7 @@ |
||
| 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 | } |
@@ -6,7 +6,7 @@ |
||
| 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 | |
@@ -6,7 +6,7 @@ |
||
| 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 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | public function testWithNamespaces() |
| 34 | 34 | { |
| 35 | 35 | $namespaces = [ |
| 36 | - '\my\namespace','another','one\more' |
|
| 36 | + '\my\namespace', 'another', 'one\more' |
|
| 37 | 37 | ]; |
| 38 | 38 | |
| 39 | 39 | $expected = [ |