@@ -28,7 +28,6 @@ |
||
| 28 | 28 | use LogicException; |
| 29 | 29 | use Psr\Http\Message\ResponseInterface; |
| 30 | 30 | use Psr\Http\Message\ServerRequestInterface; |
| 31 | -use Zend\Diactoros\Response; |
|
| 32 | 31 | use Zend\Diactoros\Response\EmptyResponse; |
| 33 | 32 | use Zend\Diactoros\ServerRequest; |
| 34 | 33 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | array $handlerParams, |
| 244 | 244 | ContainerInterface $container |
| 245 | 245 | ) { |
| 246 | - return function (ServerRequestInterface $request = null) use ($handler, $handlerParams, $container) { |
|
| 246 | + return function(ServerRequestInterface $request = null) use ($handler, $handlerParams, $container) { |
|
| 247 | 247 | return call_user_func($handler, $handlerParams, $container, $request); |
| 248 | 248 | }; |
| 249 | 249 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | private function createMethodNotAllowedTerminalHandler(array $allowedMethods) |
| 257 | 257 | { |
| 258 | 258 | // 405 Method Not Allowed |
| 259 | - return function () use ($allowedMethods) { |
|
| 259 | + return function() use ($allowedMethods) { |
|
| 260 | 260 | return $this->createEmptyResponse(405, ['Accept' => implode(',', $allowedMethods)]); |
| 261 | 261 | }; |
| 262 | 262 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | private function createNotFoundTerminalHandler() |
| 268 | 268 | { |
| 269 | 269 | // 404 Not Found |
| 270 | - return function () { |
|
| 270 | + return function() { |
|
| 271 | 271 | return $this->createEmptyResponse(404); |
| 272 | 272 | }; |
| 273 | 273 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | private function createMiddlewareChainLink(Closure $next, callable $middleware, ContainerInterface $userContainer) |
| 322 | 322 | { |
| 323 | - return function (ServerRequestInterface $request) use ($next, $middleware, $userContainer) { |
|
| 323 | + return function(ServerRequestInterface $request) use ($next, $middleware, $userContainer) { |
|
| 324 | 324 | return call_user_func($middleware, $request, $next, $userContainer); |
| 325 | 325 | }; |
| 326 | 326 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | - * @return callable |
|
| 136 | + * @return string[] |
|
| 137 | 137 | */ |
| 138 | 138 | public static function getDefaultRequestFactory() |
| 139 | 139 | { |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | /** |
| 299 | 299 | * @param Closure $handler |
| 300 | 300 | * @param ContainerInterface $userContainer |
| 301 | - * @param array|null $globalMiddleware |
|
| 301 | + * @param callable[] $globalMiddleware |
|
| 302 | 302 | * @param array|null $routeMiddleware |
| 303 | 303 | * |
| 304 | 304 | * @return Closure |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | * @param int|string $key |
| 354 | 354 | * @param mixed $default |
| 355 | 355 | * |
| 356 | - * @return mixed |
|
| 356 | + * @return string |
|
| 357 | 357 | */ |
| 358 | 358 | private function getValue(array $config, $key, $default) |
| 359 | 359 | { |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | class Group extends BaseGroup |
| 23 | 23 | { |
| 24 | 24 | /** |
| 25 | - * @return null |
|
| 25 | + * @return null|\Limoncello\Core\Contracts\Routing\GroupInterface |
|
| 26 | 26 | */ |
| 27 | 27 | public function parentGroup() |
| 28 | 28 | { |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | $this->sapiEmitter = $sapiEmitter; |
| 105 | 105 | |
| 106 | 106 | // returns value if not null or $fallback otherwise |
| 107 | - $get = function ($nullable, $fallback) { |
|
| 107 | + $get = function($nullable, $fallback) { |
|
| 108 | 108 | return $nullable !== null ? $nullable : $fallback; |
| 109 | 109 | }; |
| 110 | 110 | |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | protected function normalizeUri($uri, $trailingSlash) |
| 31 | 31 | { |
| 32 | 32 | // add starting '/' and cut ending '/' if necessary |
| 33 | - $uri = strlen($uri) > 0 && $uri[0] === '/' ? $uri : '/' . $uri; |
|
| 33 | + $uri = strlen($uri) > 0 && $uri[0] === '/' ? $uri : '/'.$uri; |
|
| 34 | 34 | $prefixLen = strlen($uri); |
| 35 | 35 | $uri = $prefixLen > 1 && substr($uri, -1) === '/' ? substr($uri, 0, $prefixLen - 1) : $uri; |
| 36 | 36 | |
| 37 | 37 | // feature: trailing slashes are possible when asked |
| 38 | - $uri = $trailingSlash === true && substr($uri, -1) !== '/' ? $uri . '/' : $uri; |
|
| 38 | + $uri = $trailingSlash === true && substr($uri, -1) !== '/' ? $uri.'/' : $uri; |
|
| 39 | 39 | |
| 40 | 40 | return $uri; |
| 41 | 41 | } |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | // only one has '/' |
| 55 | 55 | if ($fEndsWithSlash xor $sStartsWithSlash) { |
| 56 | - return $uri1 . $uri2; |
|
| 56 | + return $uri1.$uri2; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // either both have '/' nor both don't have |
| 60 | 60 | |
| 61 | - $result = $fEndsWithSlash === true ? $uri1 . substr($uri2, 1) : $uri1 . '/' . $uri2; |
|
| 61 | + $result = $fEndsWithSlash === true ? $uri1.substr($uri2, 1) : $uri1.'/'.$uri2; |
|
| 62 | 62 | |
| 63 | 63 | return $result; |
| 64 | 64 | } |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | */ |
| 64 | 64 | protected function getCallableToCacheMessage() |
| 65 | 65 | { |
| 66 | - return 'Value either not callable or cannot be cached. ' . |
|
| 66 | + return 'Value either not callable or cannot be cached. '. |
|
| 67 | 67 | 'Use callable in form of \'ClassName::methodName\' or [ClassName::class, \'methodName\'].'; |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | - * @return callable |
|
| 59 | + * @return string[] |
|
| 60 | 60 | * |
| 61 | 61 | * @SuppressWarnings(PHPMD.StaticAccess) |
| 62 | 62 | */ |
@@ -188,7 +188,7 @@ |
||
| 188 | 188 | */ |
| 189 | 189 | public function getName() |
| 190 | 190 | { |
| 191 | - $result = $this->name !== null ? $this->getGroup()->getName() . $this->name : null; |
|
| 191 | + $result = $this->name !== null ? $this->getGroup()->getName().$this->name : null; |
|
| 192 | 192 | |
| 193 | 193 | return $result; |
| 194 | 194 | } |
@@ -141,7 +141,7 @@ |
||
| 141 | 141 | { |
| 142 | 142 | $this->checkRoutesLoaded(); |
| 143 | 143 | |
| 144 | - list(, , $namedRouteUriPaths) = $this->cachedRoutes; |
|
| 144 | + list(,, $namedRouteUriPaths) = $this->cachedRoutes; |
|
| 145 | 145 | |
| 146 | 146 | $result = array_key_exists($routeName, $namedRouteUriPaths) === true ? $namedRouteUriPaths[$routeName] : null; |
| 147 | 147 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | { |
| 47 | 47 | $parentGroupName = $this->parentGroup()->getName(); |
| 48 | 48 | $selfName = parent::getName(); |
| 49 | - $result = $parentGroupName !== null || $selfName !== null ? $parentGroupName . $selfName : null; |
|
| 49 | + $result = $parentGroupName !== null || $selfName !== null ? $parentGroupName.$selfName : null; |
|
| 50 | 50 | |
| 51 | 51 | return $result; |
| 52 | 52 | } |