| @@ -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 | */ | 
| @@ -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 | } | 
| @@ -147,7 +147,7 @@ discard block | ||
| 147 | 147 | } | 
| 148 | 148 | |
| 149 | 149 | /** | 
| 150 | - * @return callable | |
| 150 | + * @return string[] | |
| 151 | 151 | */ | 
| 152 | 152 | public static function getDefaultRequestFactory(): callable | 
| 153 | 153 |      { | 
| @@ -213,7 +213,7 @@ discard block | ||
| 213 | 213 | |
| 214 | 214 | /** | 
| 215 | 215 | * @param LimoncelloContainerInterface $container | 
| 216 | - * @param callable[]|null $globalConfigurators | |
| 216 | + * @param callable[] $globalConfigurators | |
| 217 | 217 | * @param callable[]|null $routeConfigurators | 
| 218 | 218 | * | 
| 219 | 219 | * @return void | 
| @@ -178,7 +178,7 @@ discard block | ||
| 178 | 178 | * | 
| 179 | 179 | * @return ResponseInterface | 
| 180 | 180 | */ | 
| 181 | - protected function handleRequest(Closure $handler, ?RequestInterface $request): ResponseInterface | |
| 181 | + protected function handleRequest(Closure $handler, ?RequestInterface $request) : ResponseInterface | |
| 182 | 182 |      { | 
| 183 | 183 | $response = call_user_func($handler, $request); | 
| 184 | 184 | |
| @@ -196,7 +196,7 @@ discard block | ||
| 196 | 196 | protected function handleThrowable( | 
| 197 | 197 | Throwable $throwable, | 
| 198 | 198 | ?PsrContainerInterface $container | 
| 199 | -    ): ThrowableResponseInterface { | |
| 199 | +    ) : ThrowableResponseInterface { | |
| 200 | 200 |          if ($container !== null && $container->has(ThrowableHandlerInterface::class) === true) { | 
| 201 | 201 | /** @var ThrowableHandlerInterface $handler */ | 
| 202 | 202 | /** @noinspection PhpUnhandledExceptionInspection */ | 
| @@ -240,7 +240,7 @@ discard block | ||
| 240 | 240 | */ | 
| 241 | 241 | public function __construct(Throwable $throwable, int $status) | 
| 242 | 242 |              { | 
| 243 | - parent::__construct((string)$throwable, $status); | |
| 243 | + parent::__construct((string) $throwable, $status); | |
| 244 | 244 | $this->setThrowable($throwable); | 
| 245 | 245 | } | 
| 246 | 246 | }; | 
| @@ -323,7 +323,7 @@ discard block | ||
| 323 | 323 | ['array', PsrContainerInterface::class, ServerRequestInterface::class], | 
| 324 | 324 | ResponseInterface::class | 
| 325 | 325 | ), | 
| 326 | - 'Handler method should have signature ' . | |
| 326 | + 'Handler method should have signature '. | |
| 327 | 327 | '`public static methodName(array, PsrContainerInterface, ServerRequestInterface): ResponseInterface`' | 
| 328 | 328 | ); | 
| 329 | 329 | |
| @@ -364,7 +364,7 @@ discard block | ||
| 364 | 364 | array $handlerParams, | 
| 365 | 365 | PsrContainerInterface $container | 
| 366 | 366 |      ): Closure { | 
| 367 | - return function (ServerRequestInterface $request = null) use ( | |
| 367 | + return function(ServerRequestInterface $request = null) use ( | |
| 368 | 368 | $handler, | 
| 369 | 369 | $handlerParams, | 
| 370 | 370 | $container | 
| @@ -396,7 +396,7 @@ discard block | ||
| 396 | 396 | [SapiInterface::class, PsrContainerInterface::class], | 
| 397 | 397 | ServerRequestInterface::class | 
| 398 | 398 | ), | 
| 399 | - 'Factory method should have signature ' . | |
| 399 | + 'Factory method should have signature '. | |
| 400 | 400 | '`public static methodName(SapiInterface, PsrContainerInterface): ServerRequestInterface`' | 
| 401 | 401 | ); | 
| 402 | 402 | |
| @@ -413,7 +413,7 @@ discard block | ||
| 413 | 413 | private function createMethodNotAllowedTerminalHandler(array $allowedMethods): Closure | 
| 414 | 414 |      { | 
| 415 | 415 | // 405 Method Not Allowed | 
| 416 | -        return function () use ($allowedMethods): ResponseInterface { | |
| 416 | +        return function() use ($allowedMethods): ResponseInterface { | |
| 417 | 417 |              return $this->createEmptyResponse(405, ['Accept' => implode(',', $allowedMethods)]); | 
| 418 | 418 | }; | 
| 419 | 419 | } | 
| @@ -424,7 +424,7 @@ discard block | ||
| 424 | 424 | private function createNotFoundTerminalHandler(): Closure | 
| 425 | 425 |      { | 
| 426 | 426 | // 404 Not Found | 
| 427 | -        return function (): ResponseInterface { | |
| 427 | +        return function(): ResponseInterface { | |
| 428 | 428 | return $this->createEmptyResponse(404); | 
| 429 | 429 | }; | 
| 430 | 430 | } | 
| @@ -470,11 +470,11 @@ discard block | ||
| 470 | 470 | [ServerRequestInterface::class, Closure::class, PsrContainerInterface::class], | 
| 471 | 471 | ResponseInterface::class | 
| 472 | 472 | ), | 
| 473 | - 'Middleware method should have signature ' . | |
| 473 | + 'Middleware method should have signature '. | |
| 474 | 474 | '`public static methodName(ServerRequestInterface, Closure, PsrContainerInterface): ResponseInterface`' | 
| 475 | 475 | ); | 
| 476 | 476 | |
| 477 | -        return function (ServerRequestInterface $request) use ($next, $middleware, $container): ResponseInterface { | |
| 477 | +        return function(ServerRequestInterface $request) use ($next, $middleware, $container): ResponseInterface { | |
| 478 | 478 | return call_user_func($middleware, $request, $next, $container); | 
| 479 | 479 | }; | 
| 480 | 480 | } | 
| @@ -84,7 +84,7 @@ discard block | ||
| 84 | 84 | $methodParam = $methodParams[$index]; | 
| 85 | 85 |              if (is_string($parameter) === true) { | 
| 86 | 86 | $methodType = $methodParam->getType(); | 
| 87 | -                if ($methodType === null || (string)$methodType !== $parameter) { | |
| 87 | +                if ($methodType === null || (string) $methodType !== $parameter) { | |
| 88 | 88 | $isParamOk = false; | 
| 89 | 89 | } | 
| 90 | 90 |              } elseif ($parameter === null) { | 
| @@ -112,7 +112,7 @@ discard block | ||
| 112 | 112 | $isReturnTypeOk = true; | 
| 113 | 113 |          if ($areAllParamsOk === true && $returnType !== null) { | 
| 114 | 114 | $methodRetType = $reflectionMethod->getReturnType(); | 
| 115 | - $isReturnTypeOk = $methodRetType !== null && (string)$methodRetType === $returnType; | |
| 115 | + $isReturnTypeOk = $methodRetType !== null && (string) $methodRetType === $returnType; | |
| 116 | 116 | } | 
| 117 | 117 | |
| 118 | 118 | $isOk = $areAllParamsOk === true && $isReturnTypeOk === true; | 
| @@ -30,12 +30,12 @@ discard block | ||
| 30 | 30 | protected function normalizeUri(string $uri, bool $trailingSlash): string | 
| 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 | } | 
| @@ -26,7 +26,7 @@ | ||
| 26 | 26 | */ | 
| 27 | 27 | protected function getCallableToCacheMessage(): string | 
| 28 | 28 |      { | 
| 29 | - return 'Value either not callable or cannot be cached or do not meet method signature requirements. ' . | |
| 29 | + return 'Value either not callable or cannot be cached or do not meet method signature requirements. '. | |
| 30 | 30 | 'Use callable in form of \'ClassName::methodName\' or [ClassName::class, \'methodName\'].'; | 
| 31 | 31 | } | 
| 32 | 32 | } | 
| @@ -150,7 +150,7 @@ discard block | ||
| 150 | 150 | /** | 
| 151 | 151 | * @inheritdoc | 
| 152 | 152 | */ | 
| 153 | - public function getRequestFactory(): ?callable | |
| 153 | + public function getRequestFactory(): ? callable | |
| 154 | 154 |      { | 
| 155 | 155 |          if ($this->isUseGroupRequestFactory() === true) { | 
| 156 | 156 | return $this->getGroup()->getRequestFactory(); | 
| @@ -184,7 +184,7 @@ discard block | ||
| 184 | 184 | */ | 
| 185 | 185 | public function getName(): ?string | 
| 186 | 186 |      { | 
| 187 | - $result = $this->name !== null ? (string)$this->getGroup()->getName() . $this->name : null; | |
| 187 | + $result = $this->name !== null ? (string) $this->getGroup()->getName().$this->name : null; | |
| 188 | 188 | |
| 189 | 189 | return $result; | 
| 190 | 190 | } | 
| @@ -167,7 +167,7 @@ | ||
| 167 | 167 | /** | 
| 168 | 168 | * @inheritdoc | 
| 169 | 169 | */ | 
| 170 | - public function getRequestFactory(): ?callable | |
| 170 | + public function getRequestFactory(): ? callable | |
| 171 | 171 |      { | 
| 172 | 172 |          if ($this->isRequestFactorySet() === true) { | 
| 173 | 173 | return $this->requestFactory; | 
| @@ -150,7 +150,7 @@ discard block | ||
| 150 | 150 |      { | 
| 151 | 151 | $this->checkRoutesLoaded(); | 
| 152 | 152 | |
| 153 | - list(, , $namedRouteUriPaths) = $this->cachedRoutes; | |
| 153 | + list(,, $namedRouteUriPaths) = $this->cachedRoutes; | |
| 154 | 154 | |
| 155 | 155 | $result = array_key_exists($routeName, $namedRouteUriPaths) === true ? $namedRouteUriPaths[$routeName] : null; | 
| 156 | 156 | |
| @@ -168,7 +168,7 @@ discard block | ||
| 168 | 168 |      ): string { | 
| 169 | 169 | $path = $this->getUriPath($routeName); | 
| 170 | 170 | $path = $path === null ? $path : $this->replacePlaceholders($path, $placeholders); | 
| 171 | - $url = empty($queryParams) === true ? "$hostUri$path" : "$hostUri$path?" . http_build_query($queryParams); | |
| 171 | + $url = empty($queryParams) === true ? "$hostUri$path" : "$hostUri$path?".http_build_query($queryParams); | |
| 172 | 172 | |
| 173 | 173 | return $url; | 
| 174 | 174 | } | 
| @@ -227,7 +227,7 @@ discard block | ||
| 227 | 227 | break; | 
| 228 | 228 | case '}': | 
| 229 | 229 | $result .= array_key_exists($curPlaceholder, $placeholders) === true ? | 
| 230 | -                        $placeholders[$curPlaceholder] : '{' . $curPlaceholder . '}'; | |
| 230 | +                        $placeholders[$curPlaceholder] : '{'.$curPlaceholder.'}'; | |
| 231 | 231 | $inPlaceholder = false; | 
| 232 | 232 | $curPlaceholder = null; | 
| 233 | 233 | $inPlaceholderName = false; |