diff --git a/src/Business/Executor/RouteExecutor.php b/src/Business/Executor/RouteExecutor.php index cce9ec7..2194cbd 100644 --- a/src/Business/Executor/RouteExecutor.php +++ b/src/Business/Executor/RouteExecutor.php @@ -35,13 +35,10 @@ public function __construct( ) { } - /** - * {@inheritDoc} - */ public function execute(Request $request, bool $flush = true): Response { $route = $this->urlMatcher->match($request); - $this->containerRegistry->register(Request::class, fn (): Request => $request); + $this->containerRegistry->register(Request::class, fn (): Request => $request, true); $callback = $this->responseCallbackFactory->create($route); try { diff --git a/src/Business/Executor/RouteExecutorFactory.php b/src/Business/Executor/RouteExecutorFactory.php index 11dd49f..e2801c1 100644 --- a/src/Business/Executor/RouteExecutorFactory.php +++ b/src/Business/Executor/RouteExecutorFactory.php @@ -31,9 +31,6 @@ public function __construct( ) { } - /** - * {@inheritDoc} - */ public function create(): RouteExecutorInterface { return new RouteExecutor( diff --git a/src/Business/Generator/UrlGenerator.php b/src/Business/Generator/UrlGenerator.php index 23a39d0..4f61c97 100644 --- a/src/Business/Generator/UrlGenerator.php +++ b/src/Business/Generator/UrlGenerator.php @@ -24,9 +24,6 @@ public function __construct(private RouteCollectionInterface $routeCollection) { } - /** - * {@inheritDoc} - */ public function generateUrlByRouteName(string $routeName, array|null $parameters = []): string { $route = $this->routeCollection->getRouteByName($routeName); diff --git a/src/Business/Generator/UrlGeneratorFactory.php b/src/Business/Generator/UrlGeneratorFactory.php index 733f76a..646935a 100644 --- a/src/Business/Generator/UrlGeneratorFactory.php +++ b/src/Business/Generator/UrlGeneratorFactory.php @@ -25,9 +25,6 @@ public function __construct( ) { } - /** - * {@inheritDoc} - */ public function create(): UrlGeneratorInterface { return new UrlGenerator($this->routeCollectionFactory->create()); diff --git a/src/Business/Locator/RouteLocatorFactory.php b/src/Business/Locator/RouteLocatorFactory.php index 8a35588..5d0e742 100644 --- a/src/Business/Locator/RouteLocatorFactory.php +++ b/src/Business/Locator/RouteLocatorFactory.php @@ -28,9 +28,6 @@ public function __construct( ) { } - /** - * {@inheritDoc} - */ public function create(): RouteLocatorInterface { $providerType = mb_strtolower($this->configuration->getRouteLocatorType()); diff --git a/src/Business/Matcher/Route/Matchers/MethodMatcher.php b/src/Business/Matcher/Route/Matchers/MethodMatcher.php index d66bcdb..317ba2e 100644 --- a/src/Business/Matcher/Route/Matchers/MethodMatcher.php +++ b/src/Business/Matcher/Route/Matchers/MethodMatcher.php @@ -22,9 +22,6 @@ */ class MethodMatcher implements RouteMatcherInterface { - /** - * {@inheritDoc} - */ public function match(RouteInterface $route, Request $request): bool { return \in_array(mb_strtoupper($request->getMethod()), $route->getMethods()); diff --git a/src/Business/Matcher/Route/Matchers/UriMatcher.php b/src/Business/Matcher/Route/Matchers/UriMatcher.php index a724954..a18d669 100644 --- a/src/Business/Matcher/Route/Matchers/UriMatcher.php +++ b/src/Business/Matcher/Route/Matchers/UriMatcher.php @@ -22,9 +22,6 @@ */ class UriMatcher implements RouteMatcherInterface { - /** - * {@inheritDoc} - */ public function match(RouteInterface $route, Request $request): bool { $pathInfo = $request->getPathInfo(); diff --git a/src/Business/Matcher/Route/RouteMatcher.php b/src/Business/Matcher/Route/RouteMatcher.php index a5b64db..e3502f5 100644 --- a/src/Business/Matcher/Route/RouteMatcher.php +++ b/src/Business/Matcher/Route/RouteMatcher.php @@ -29,9 +29,6 @@ public function __construct( ) { } - /** - * {@inheritDoc} - */ public function match(RouteInterface $route, Request $request): bool { foreach ($this->matchers as $matcher) { diff --git a/src/Business/Matcher/UrlMatcher.php b/src/Business/Matcher/UrlMatcher.php index 9b95358..d1ede78 100644 --- a/src/Business/Matcher/UrlMatcher.php +++ b/src/Business/Matcher/UrlMatcher.php @@ -30,9 +30,6 @@ public function __construct( ) { } - /** - * {@inheritDoc} - */ public function match(Request $request): RouteInterface { foreach ($this->routeCollection->iterateRoutes() as $route) { diff --git a/src/Business/Matcher/UrlMatcherFactory.php b/src/Business/Matcher/UrlMatcherFactory.php index 0d66dea..08d3d63 100644 --- a/src/Business/Matcher/UrlMatcherFactory.php +++ b/src/Business/Matcher/UrlMatcherFactory.php @@ -27,9 +27,6 @@ public function __construct( ) { } - /** - * {@inheritDoc} - */ public function create(): UrlMatcherInterface { return new UrlMatcher( diff --git a/src/Business/Response/Callback/ResponseCallback.php b/src/Business/Response/Callback/ResponseCallback.php index 5008157..1462dd8 100644 --- a/src/Business/Response/Callback/ResponseCallback.php +++ b/src/Business/Response/Callback/ResponseCallback.php @@ -28,9 +28,6 @@ public function __construct( ) { } - /** - * {@inheritDoc} - */ public function __invoke(): mixed { $controller = $this->route->getController(); diff --git a/src/Business/Response/Transformer/ResponseTransformer.php b/src/Business/Response/Transformer/ResponseTransformer.php index bfa814c..f9bfe5b 100644 --- a/src/Business/Response/Transformer/ResponseTransformer.php +++ b/src/Business/Response/Transformer/ResponseTransformer.php @@ -29,9 +29,6 @@ public function __construct( ) { } - /** - * {@inheritDoc} - */ public function transform(Request $request, Response $response, mixed &$responseData): bool { $transformed = false; diff --git a/src/Business/Route/Route.php b/src/Business/Route/Route.php index 0982645..7d5053b 100644 --- a/src/Business/Route/Route.php +++ b/src/Business/Route/Route.php @@ -20,8 +20,6 @@ { /** * @param array|class-string|\Closure|object $controller - * @param string|null $pattern - * @param array|null $parameters * * @phpstan-ignore-next-line */ @@ -35,49 +33,31 @@ public function __construct( ) { } - /** - * {@inheritDoc} - */ public function getUri(): string { return $this->uri; } - /** - * {@inheritDoc} - */ public function getController(): callable|string|array|object { return $this->controller; } - /** - * {@inheritDoc} - */ public function getMethods(): array { return $this->methods; } - /** - * {@inheritDoc} - */ public function getName(): string|null { return $this->name; } - /** - * {@inheritDoc} - */ public function getPattern(): string|null { return $this->pattern; } - /** - * {@inheritDoc} - */ public function getParameters(): array|null { return $this->parameters; diff --git a/src/Business/Route/RouteBuilder.php b/src/Business/Route/RouteBuilder.php index 98d0d98..cea4037 100644 --- a/src/Business/Route/RouteBuilder.php +++ b/src/Business/Route/RouteBuilder.php @@ -48,9 +48,6 @@ public function __construct( $this->methods = $this->methodsByDefault; } - /** - * {@inheritDoc} - */ public function setName(string $name): self { $this->name = $name; @@ -58,9 +55,6 @@ public function setName(string $name): self return $this; } - /** - * {@inheritDoc} - */ public function addMethod(string $method): self { if (!\in_array($method, $this->methods)) { @@ -70,9 +64,6 @@ public function addMethod(string $method): self return $this; } - /** - * {@inheritDoc} - */ public function setMethods(array $methods): self { $this->methods = []; @@ -84,9 +75,6 @@ public function setMethods(array $methods): self return $this; } - /** - * {@inheritDoc} - */ public function setController(string|array|\Closure $action): self { $this->action = $action; @@ -94,9 +82,6 @@ public function setController(string|array|\Closure $action): self return $this; } - /** - * {@inheritDoc} - */ public function setUri(string $uri): self { $this->uri = $uri; @@ -128,10 +113,10 @@ public function build(): RouteInterface } if ( - $this->action && - ( - !\is_callable($this->action) && - (\is_string($this->action) && (class_exists($this->action) && !$this->name)) + $this->action + && ( + !\is_callable($this->action) + && (\is_string($this->action) && (class_exists($this->action) && !$this->name)) ) ) { $exceptions[] = 'The route action should be callable. Examples: `[object, "method|"], [Classname, "metnod|"], Classname::method, Classname, function() {}` Current value: '.$this->action; diff --git a/src/Business/Route/RouteBuilderFactory.php b/src/Business/Route/RouteBuilderFactory.php index 0391a6a..f0375e2 100644 --- a/src/Business/Route/RouteBuilderFactory.php +++ b/src/Business/Route/RouteBuilderFactory.php @@ -18,9 +18,6 @@ */ readonly class RouteBuilderFactory implements RouteBuilderFactoryInterface { - /** - * {@inheritDoc} - */ public function create(): RouteBuilderInterface { return new RouteBuilder(); diff --git a/src/Business/Route/RouteCollection.php b/src/Business/Route/RouteCollection.php index 608eee2..0429668 100644 --- a/src/Business/Route/RouteCollection.php +++ b/src/Business/Route/RouteCollection.php @@ -48,9 +48,6 @@ public function __construct(array $routes = []) $this->setRoutes($routes); } - /** - * {@inheritDoc} - */ public function setRoutes(iterable $routes): self { $this->routes = []; @@ -64,9 +61,6 @@ public function setRoutes(iterable $routes): self return $this; } - /** - * {@inheritDoc} - */ public function addRoute(RouteInterface $route): self { $routeName = $route->getName(); @@ -90,9 +84,6 @@ public function addRoute(RouteInterface $route): self return $this; } - /** - * {@inheritDoc} - */ public function getRouteByName(string $name): RouteInterface { if (!\array_key_exists($name, $this->routes)) { @@ -102,25 +93,16 @@ public function getRouteByName(string $name): RouteInterface return $this->routes[$name]; } - /** - * {@inheritDoc} - */ public function getRoutes(): iterable { return array_values($this->routes); } - /** - * {@inheritDoc} - */ public function getRoutesNames(): array { return array_keys($this->routes); } - /** - * {@inheritDoc} - */ public function iterateRoutes(): iterable { foreach ($this->routesNamesStatic as $routeName) { diff --git a/src/Business/Route/RouteCollectionFactory.php b/src/Business/Route/RouteCollectionFactory.php index 504211a..e24c0fc 100644 --- a/src/Business/Route/RouteCollectionFactory.php +++ b/src/Business/Route/RouteCollectionFactory.php @@ -28,9 +28,6 @@ public function __construct( $this->routeCollection = null; } - /** - * {@inheritDoc} - */ public function create(): RouteCollectionInterface { if ($this->routeCollection) { diff --git a/src/Exception/HttpBadRequestException.php b/src/Exception/HttpBadRequestException.php index 15b3c1a..fc49bf1 100644 --- a/src/Exception/HttpBadRequestException.php +++ b/src/Exception/HttpBadRequestException.php @@ -18,10 +18,7 @@ */ class HttpBadRequestException extends HttpException { - /** - * @param \Throwable|null $previous - */ - public function __construct(string $message = 'Bad Request.', \Throwable|null $previous = null) + public function __construct(string $message = 'Bad Request.', \Throwable $previous = null) { parent::__construct($message, 400, $previous); } diff --git a/src/Exception/HttpException.php b/src/Exception/HttpException.php index 8428073..73a8708 100644 --- a/src/Exception/HttpException.php +++ b/src/Exception/HttpException.php @@ -21,7 +21,7 @@ class HttpException extends \RuntimeException public function __construct( string $message = '', int $code = 0, - ?\Throwable $previous = null + \Throwable $previous = null ) { parent::__construct($message, $code, $previous); } diff --git a/src/Exception/HttpForbiddenException.php b/src/Exception/HttpForbiddenException.php index effc77d..c6b68f3 100644 --- a/src/Exception/HttpForbiddenException.php +++ b/src/Exception/HttpForbiddenException.php @@ -18,7 +18,7 @@ */ class HttpForbiddenException extends HttpException { - public function __construct(string $message = 'Forbidden.', ?\Throwable $previous = null) + public function __construct(string $message = 'Forbidden.', \Throwable $previous = null) { parent::__construct($message, 403, $previous); } diff --git a/src/Exception/HttpInternalServerException.php b/src/Exception/HttpInternalServerException.php index 84db8ea..d195f7a 100644 --- a/src/Exception/HttpInternalServerException.php +++ b/src/Exception/HttpInternalServerException.php @@ -18,7 +18,7 @@ */ class HttpInternalServerException extends HttpException { - public function __construct(string $message = 'Internal Server Error.', ?\Throwable $previous = null) + public function __construct(string $message = 'Internal Server Error.', \Throwable $previous = null) { parent::__construct($message, 500, $previous); } diff --git a/src/Exception/HttpNotFoundException.php b/src/Exception/HttpNotFoundException.php index 7395c0f..39dc351 100644 --- a/src/Exception/HttpNotFoundException.php +++ b/src/Exception/HttpNotFoundException.php @@ -18,7 +18,7 @@ */ class HttpNotFoundException extends HttpException { - public function __construct(string $message = 'Not Found.', ?\Throwable $previous = null) + public function __construct(string $message = 'Not Found.', \Throwable $previous = null) { parent::__construct($message, 404, $previous); } diff --git a/src/Exception/HttpUnauthorizedException.php b/src/Exception/HttpUnauthorizedException.php index dda1e8b..474be13 100644 --- a/src/Exception/HttpUnauthorizedException.php +++ b/src/Exception/HttpUnauthorizedException.php @@ -18,7 +18,7 @@ */ class HttpUnauthorizedException extends HttpException { - public function __construct(string $message = 'Unauthorized.', ?\Throwable $previous = null) + public function __construct(string $message = 'Unauthorized.', \Throwable $previous = null) { parent::__construct($message, 401, $previous); } diff --git a/src/Exception/ResponseInvalidException.php b/src/Exception/ResponseInvalidException.php index d6bc9ee..686f99c 100644 --- a/src/Exception/ResponseInvalidException.php +++ b/src/Exception/ResponseInvalidException.php @@ -20,7 +20,7 @@ class ResponseInvalidException extends \RuntimeException { private mixed $responseData; - public function __construct(mixed $responseData, int $code = 0, ?\Throwable $previous = null) + public function __construct(mixed $responseData, int $code = 0, \Throwable $previous = null) { parent::__construct('Invalid response object type.', $code, $previous); diff --git a/src/Exception/RouteAlreadyDeclaredException.php b/src/Exception/RouteAlreadyDeclaredException.php index 3965803..0e958ea 100644 --- a/src/Exception/RouteAlreadyDeclaredException.php +++ b/src/Exception/RouteAlreadyDeclaredException.php @@ -18,7 +18,7 @@ */ class RouteAlreadyDeclaredException extends RouteConfigurationException { - public function __construct(string $routeName, int $code = 0, ?\Throwable $previous = null) + public function __construct(string $routeName, int $code = 0, \Throwable $previous = null) { parent::__construct(sprintf('The route "%s" already defined and can not be redeclare.', $routeName), $code, $previous); } diff --git a/src/Exception/RouteInvalidConfigurationException.php b/src/Exception/RouteInvalidConfigurationException.php index 5d79ca8..1554d6f 100644 --- a/src/Exception/RouteInvalidConfigurationException.php +++ b/src/Exception/RouteInvalidConfigurationException.php @@ -26,7 +26,7 @@ class RouteInvalidConfigurationException extends RouteConfigurationException /** * @param string[] $messages */ - public function __construct(string $routeName, array $messages, int $code = 0, ?\Throwable $previous = null) + public function __construct(string $routeName, array $messages, int $code = 0, \Throwable $previous = null) { $message = <<routeBuilderFactory->create(); } - /** - * {@inheritDoc} - */ public function getDeclaredRoutesNames(): iterable { return $this->routeCollectionFactory @@ -55,9 +49,6 @@ public function getDeclaredRoutesNames(): iterable ->getRoutesNames(); } - /** - * {@inheritDoc} - */ public function match(Request $request): RouteInterface { return $this->urlMatcherFactory @@ -65,9 +56,6 @@ public function match(Request $request): RouteInterface ->match($request); } - /** - * {@inheritDoc} - */ public function execute(Request $request, bool $flush = true): Response { return $this->routeExecutorFactory @@ -75,9 +63,6 @@ public function execute(Request $request, bool $flush = true): Response ->execute($request, $flush); } - /** - * {@inheritDoc} - */ public function generateUrlByRouteName(string $routeName, array|null $parameters = []): string { return $this->urlGeneratorFactory diff --git a/src/HttpCorePlugin.php b/src/HttpCorePlugin.php index 39362bf..827eef5 100644 --- a/src/HttpCorePlugin.php +++ b/src/HttpCorePlugin.php @@ -57,9 +57,6 @@ class HttpCorePlugin implements DependencyProviderInterface, ConfigurableInterfa private Container $container; - /** - * {@inheritDoc} - */ public function provideDependencies(Container $container): void { $this->container = $container; diff --git a/src/HttpCorePluginConfiguration.php b/src/HttpCorePluginConfiguration.php index 78a4834..eb69bef 100644 --- a/src/HttpCorePluginConfiguration.php +++ b/src/HttpCorePluginConfiguration.php @@ -24,9 +24,6 @@ class HttpCorePluginConfiguration extends PluginConfiguration implements HttpCor public const CFG_LOCATOR_TYPE_DEFAULT = 'code'; public const CFG_LOCATOR_TYPE = 'MICRO_HTTP_ROUTE_LOCATOR'; - /** - * {@inheritDoc} - */ public function getRouteLocatorType(): string { return $this->configuration->get(self::CFG_LOCATOR_TYPE, self::CFG_LOCATOR_TYPE_DEFAULT, false);