@@ -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 |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | protected function handleThrowable( |
| 201 | 201 | Throwable $throwable, |
| 202 | 202 | ?PsrContainerInterface $container |
| 203 | - ): ThrowableResponseInterface { |
|
| 203 | + ) : ThrowableResponseInterface { |
|
| 204 | 204 | if ($container !== null && $container->has(ThrowableHandlerInterface::class) === true) { |
| 205 | 205 | /** @var ThrowableHandlerInterface $handler */ |
| 206 | 206 | $handler = $container->get(ThrowableHandlerInterface::class); |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | public function __construct(Throwable $throwable, int $status) |
| 245 | 245 | { |
| 246 | - parent::__construct((string)$throwable, $status); |
|
| 246 | + parent::__construct((string) $throwable, $status); |
|
| 247 | 247 | $this->setThrowable($throwable); |
| 248 | 248 | } |
| 249 | 249 | }; |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | ['array', PsrContainerInterface::class, ServerRequestInterface::class], |
| 327 | 327 | ResponseInterface::class |
| 328 | 328 | ), |
| 329 | - 'Handler method should have signature ' . |
|
| 329 | + 'Handler method should have signature '. |
|
| 330 | 330 | '`public static methodName(array, PsrContainerInterface, ServerRequestInterface): ResponseInterface`' |
| 331 | 331 | ); |
| 332 | 332 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | [SapiInterface::class, PsrContainerInterface::class], |
| 375 | 375 | ServerRequestInterface::class |
| 376 | 376 | ), |
| 377 | - 'Factory method should have signature ' . |
|
| 377 | + 'Factory method should have signature '. |
|
| 378 | 378 | '`public static methodName(SapiInterface, PsrContainerInterface): ServerRequestInterface`' |
| 379 | 379 | ); |
| 380 | 380 | |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | array $handlerParams, |
| 396 | 396 | PsrContainerInterface $container |
| 397 | 397 | ): Closure { |
| 398 | - return function (ServerRequestInterface $request = null) use ( |
|
| 398 | + return function(ServerRequestInterface $request = null) use ( |
|
| 399 | 399 | $handler, |
| 400 | 400 | $handlerParams, |
| 401 | 401 | $container |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | private function createMethodNotAllowedTerminalHandler(array $allowedMethods): Closure |
| 417 | 417 | { |
| 418 | 418 | // 405 Method Not Allowed |
| 419 | - return function () use ($allowedMethods): ResponseInterface { |
|
| 419 | + return function() use ($allowedMethods): ResponseInterface { |
|
| 420 | 420 | return $this->createEmptyResponse(405, ['Accept' => implode(',', $allowedMethods)]); |
| 421 | 421 | }; |
| 422 | 422 | } |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | private function createNotFoundTerminalHandler(): Closure |
| 428 | 428 | { |
| 429 | 429 | // 404 Not Found |
| 430 | - return function (): ResponseInterface { |
|
| 430 | + return function(): ResponseInterface { |
|
| 431 | 431 | return $this->createEmptyResponse(404); |
| 432 | 432 | }; |
| 433 | 433 | } |
@@ -471,11 +471,11 @@ discard block |
||
| 471 | 471 | [ServerRequestInterface::class, Closure::class, PsrContainerInterface::class], |
| 472 | 472 | ResponseInterface::class |
| 473 | 473 | ), |
| 474 | - 'Middleware method should have signature ' . |
|
| 474 | + 'Middleware method should have signature '. |
|
| 475 | 475 | '`public static methodName(ServerRequestInterface, Closure, PsrContainerInterface): ResponseInterface`' |
| 476 | 476 | ); |
| 477 | 477 | |
| 478 | - return function (ServerRequestInterface $request) use ($next, $middleware, $container): ResponseInterface { |
|
| 478 | + return function(ServerRequestInterface $request) use ($next, $middleware, $container): ResponseInterface { |
|
| 479 | 479 | return call_user_func($middleware, $request, $next, $container); |
| 480 | 480 | }; |
| 481 | 481 | } |
@@ -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; |