From 23d37db8f6a4a6846132d194391be1549b3a537c Mon Sep 17 00:00:00 2001 From: Continuous Integration Date: Thu, 30 Nov 2023 20:39:40 +0000 Subject: [PATCH] Continuous Integration Fixes --- src/Bootstrap.php | 8 ++++---- src/Handler/Lol.php | 3 +-- src/Infrastructure/Event/AsListener.php | 3 +-- src/Infrastructure/Event/Dispatcher.php | 7 +++---- src/Infrastructure/Event/DispatcherFactory.php | 3 +-- src/Infrastructure/Event/Listener.php | 3 +-- src/Infrastructure/Finder.php | 7 +++---- src/Infrastructure/HttpKernel.php | 3 +-- src/Infrastructure/Route/AsHandler.php | 3 +-- src/Infrastructure/Route/Handler.php | 3 +-- src/Infrastructure/WebApp/Request/RequestEvent.php | 3 +-- .../WebApp/Route/AttributeRouteCollector.php | 3 +-- src/Infrastructure/WebApp/Route/CollectRoutes.php | 3 +-- src/Infrastructure/WebApp/Route/HandlerCaller.php | 3 +-- src/Infrastructure/WebApp/Route/HandlerResolver.php | 3 +-- src/Listener/LauschEvent.php | 3 +-- 16 files changed, 23 insertions(+), 38 deletions(-) diff --git a/src/Bootstrap.php b/src/Bootstrap.php index 2c276d6..18af894 100644 --- a/src/Bootstrap.php +++ b/src/Bootstrap.php @@ -14,12 +14,12 @@ use function assert; require_once __DIR__ . '/../vendor/autoload.php'; $cached = false; -$container = (new ContainerBuilder)->addDefinitions( +$container = (new ContainerBuilder())->addDefinitions( [ - Finder::class => static fn (): Finder => new Finder(__DIR__, [], $cached), - Dispatcher::class => static fn (DispatcherFactory $f): Dispatcher + Finder::class => static fn(): Finder => new Finder(__DIR__, [], $cached), + Dispatcher::class => static fn(DispatcherFactory $f): Dispatcher => $f->getDispatcher($cached), - HandlerResolver::class => static fn (Dispatcher $d): HandlerResolver + HandlerResolver::class => static fn(Dispatcher $d): HandlerResolver => new HandlerResolver($d, $cached), ], )->build(); diff --git a/src/Handler/Lol.php b/src/Handler/Lol.php index 9fe9a4d..4ee87b2 100644 --- a/src/Handler/Lol.php +++ b/src/Handler/Lol.php @@ -11,8 +11,7 @@ final readonly class Lol { public function __construct( private Dispatcher $dispatcher - ) { - } + ) {} #[AsHandler(HttpMethod::GET, '/')] public function lol(): void diff --git a/src/Infrastructure/Event/AsListener.php b/src/Infrastructure/Event/AsListener.php index 0f04636..41ee17c 100644 --- a/src/Infrastructure/Event/AsListener.php +++ b/src/Infrastructure/Event/AsListener.php @@ -14,6 +14,5 @@ final readonly class AsListener public function __construct( public string $eventClass, public int $priority = 0 - ) { - } + ) {} } diff --git a/src/Infrastructure/Event/Dispatcher.php b/src/Infrastructure/Event/Dispatcher.php index c2ebef8..5b514c6 100644 --- a/src/Infrastructure/Event/Dispatcher.php +++ b/src/Infrastructure/Event/Dispatcher.php @@ -15,8 +15,7 @@ final class Dispatcher public function __construct( private readonly InvokerInterface $invoker, private array $listeners = [], - ) { - } + ) {} public function addListener(Listener $listener): void { @@ -30,7 +29,7 @@ final class Dispatcher { return arrayFilter( $this->listeners, - static fn (Listener $l): bool => $l->eventClass === $event::class, + static fn(Listener $l): bool => $l->eventClass === $event::class, ); } @@ -42,7 +41,7 @@ final class Dispatcher $filtered = $this->getListenerForEvent($event); usort( $filtered, - static fn (Listener $a, Listener $b): int => $a->priority <=> $b->priority, + static fn(Listener $a, Listener $b): int => $a->priority <=> $b->priority, ); return $filtered; } diff --git a/src/Infrastructure/Event/DispatcherFactory.php b/src/Infrastructure/Event/DispatcherFactory.php index b7b8062..7381e14 100644 --- a/src/Infrastructure/Event/DispatcherFactory.php +++ b/src/Infrastructure/Event/DispatcherFactory.php @@ -18,8 +18,7 @@ final readonly class DispatcherFactory public function __construct( private Finder $finder, private InvokerInterface $invoker, - ) { - } + ) {} public function getDispatcher(bool $cached = false): Dispatcher { diff --git a/src/Infrastructure/Event/Listener.php b/src/Infrastructure/Event/Listener.php index 077fd62..e0aa2a2 100644 --- a/src/Infrastructure/Event/Listener.php +++ b/src/Infrastructure/Event/Listener.php @@ -15,6 +15,5 @@ final readonly class Listener public int $priority, public string $listenerClass, public string $listenerMethod, - ) { - } + ) {} } diff --git a/src/Infrastructure/Finder.php b/src/Infrastructure/Finder.php index f75e3fb..d0ec0c2 100644 --- a/src/Infrastructure/Finder.php +++ b/src/Infrastructure/Finder.php @@ -34,8 +34,7 @@ final class Finder private readonly string $path, private array $classNames = [], private readonly bool $cached = false, - ) { - } + ) {} /** * @return Listener[] @@ -44,7 +43,7 @@ final class Finder { $this->populateClassnames(); return array_map( - static fn (array $h): Listener + static fn(array $h): Listener => new Listener($h[0]->eventClass, $h[0]->priority, $h[1], $h[2]), iterator_to_array($this->getAttributes(AsListener::class)), ); @@ -57,7 +56,7 @@ final class Finder { $this->populateClassnames(); return array_map( - static fn (array $h): Handler + static fn(array $h): Handler => new Handler($h[0]->method, $h[0]->path, $h[1], $h[2]), iterator_to_array($this->getAttributes(AsHandler::class)), ); diff --git a/src/Infrastructure/HttpKernel.php b/src/Infrastructure/HttpKernel.php index 6cce606..30da8c4 100644 --- a/src/Infrastructure/HttpKernel.php +++ b/src/Infrastructure/HttpKernel.php @@ -12,8 +12,7 @@ class HttpKernel { public function __construct( private readonly Dispatcher $dispatcher - ) { - } + ) {} public function handle(Request $request): Response { diff --git a/src/Infrastructure/Route/AsHandler.php b/src/Infrastructure/Route/AsHandler.php index 0e42d7f..dca15ed 100644 --- a/src/Infrastructure/Route/AsHandler.php +++ b/src/Infrastructure/Route/AsHandler.php @@ -13,6 +13,5 @@ final readonly class AsHandler public function __construct( public HttpMethod $method, public string $path - ) { - } + ) {} } diff --git a/src/Infrastructure/Route/Handler.php b/src/Infrastructure/Route/Handler.php index c14604a..7695c8c 100644 --- a/src/Infrastructure/Route/Handler.php +++ b/src/Infrastructure/Route/Handler.php @@ -13,6 +13,5 @@ final readonly class Handler public string $path, public string $handlerClass, public string $handlerMethod, - ) { - } + ) {} } diff --git a/src/Infrastructure/WebApp/Request/RequestEvent.php b/src/Infrastructure/WebApp/Request/RequestEvent.php index 592359e..3c59a1a 100644 --- a/src/Infrastructure/WebApp/Request/RequestEvent.php +++ b/src/Infrastructure/WebApp/Request/RequestEvent.php @@ -13,6 +13,5 @@ final class RequestEvent extends GenericEvent public Request $request, public Response|null $response = null, public Handler|null $handler = null, - ) { - } + ) {} } diff --git a/src/Infrastructure/WebApp/Route/AttributeRouteCollector.php b/src/Infrastructure/WebApp/Route/AttributeRouteCollector.php index fd6d6f2..5f1a6a7 100644 --- a/src/Infrastructure/WebApp/Route/AttributeRouteCollector.php +++ b/src/Infrastructure/WebApp/Route/AttributeRouteCollector.php @@ -9,8 +9,7 @@ final readonly class AttributeRouteCollector { public function __construct( private Finder $finder - ) { - } + ) {} #[AsListener(CollectRoutes::class)] public function collect(CollectRoutes $event): void diff --git a/src/Infrastructure/WebApp/Route/CollectRoutes.php b/src/Infrastructure/WebApp/Route/CollectRoutes.php index 15b8c13..e07e9ed 100644 --- a/src/Infrastructure/WebApp/Route/CollectRoutes.php +++ b/src/Infrastructure/WebApp/Route/CollectRoutes.php @@ -14,6 +14,5 @@ final class CollectRoutes extends GenericEvent public function __construct( public readonly bool $cached = false - ) { - } + ) {} } diff --git a/src/Infrastructure/WebApp/Route/HandlerCaller.php b/src/Infrastructure/WebApp/Route/HandlerCaller.php index 88c20fe..89b85ad 100644 --- a/src/Infrastructure/WebApp/Route/HandlerCaller.php +++ b/src/Infrastructure/WebApp/Route/HandlerCaller.php @@ -14,8 +14,7 @@ final readonly class HandlerCaller { public function __construct( private InvokerInterface $invoker - ) { - } + ) {} #[AsListener(RequestEvent::class, -50)] public function callHandler(RequestEvent $event): void diff --git a/src/Infrastructure/WebApp/Route/HandlerResolver.php b/src/Infrastructure/WebApp/Route/HandlerResolver.php index 8638ef5..9206201 100644 --- a/src/Infrastructure/WebApp/Route/HandlerResolver.php +++ b/src/Infrastructure/WebApp/Route/HandlerResolver.php @@ -21,8 +21,7 @@ final readonly class HandlerResolver public function __construct( private Dispatcher $dispatcher, private bool $cached = false, - ) { - } + ) {} #[AsListener(RequestEvent::class, -90)] public function resolveHandler(RequestEvent $event): void diff --git a/src/Listener/LauschEvent.php b/src/Listener/LauschEvent.php index 22e463a..3b8e3e4 100644 --- a/src/Listener/LauschEvent.php +++ b/src/Listener/LauschEvent.php @@ -8,6 +8,5 @@ final class LauschEvent extends GenericEvent { public function __construct( public string $message - ) { - } + ) {} }