From ff74fe7a333b5c63d3e527f67a9490086b2dabef Mon Sep 17 00:00:00 2001 From: driesvints Date: Fri, 2 Aug 2024 07:39:18 +0000 Subject: [PATCH] Fix code styling --- src/Events/ViewMatched.php | 3 +-- src/PathBasedMiddlewareList.php | 4 +--- src/PendingRoute.php | 3 +-- src/Pipeline/ContinueIterating.php | 4 +--- src/Pipeline/EnsureMatchesDomain.php | 6 ++---- .../PotentiallyBindablePathSegment.php | 4 +--- src/Pipeline/TransformModelBindings.php | 4 +--- src/RequestHandler.php | 3 +-- src/Router.php | 4 +--- tests/Feature/Console/ListCommandTest.php | 20 +++++++++---------- tests/Feature/MiddlewareTest.php | 2 +- tests/Unit/ModelBindingTest.php | 4 +--- 12 files changed, 22 insertions(+), 39 deletions(-) diff --git a/src/Events/ViewMatched.php b/src/Events/ViewMatched.php index 593faea..c215498 100644 --- a/src/Events/ViewMatched.php +++ b/src/Events/ViewMatched.php @@ -13,6 +13,5 @@ class ViewMatched public function __construct( public MatchedView $matchedView, public MountPath $mountPath, - ) { - } + ) {} } diff --git a/src/PathBasedMiddlewareList.php b/src/PathBasedMiddlewareList.php index 529b311..c7e4c75 100644 --- a/src/PathBasedMiddlewareList.php +++ b/src/PathBasedMiddlewareList.php @@ -12,9 +12,7 @@ class PathBasedMiddlewareList /** * Create a new path based middleware list instance. */ - public function __construct(public array $middleware) - { - } + public function __construct(public array $middleware) {} /** * Find the middleware that match the given matched view's path. diff --git a/src/PendingRoute.php b/src/PendingRoute.php index f5926cd..a51db1a 100644 --- a/src/PendingRoute.php +++ b/src/PendingRoute.php @@ -15,8 +15,7 @@ public function __construct( protected string $uri, protected array $middleware, protected ?string $domain = null, - ) { - } + ) {} /** * Set the domain for the route. diff --git a/src/Pipeline/ContinueIterating.php b/src/Pipeline/ContinueIterating.php index 7dbc1f1..4841332 100644 --- a/src/Pipeline/ContinueIterating.php +++ b/src/Pipeline/ContinueIterating.php @@ -7,7 +7,5 @@ class ContinueIterating /** * Create a new continue iterating instance. */ - public function __construct(public State $state) - { - } + public function __construct(public State $state) {} } diff --git a/src/Pipeline/EnsureMatchesDomain.php b/src/Pipeline/EnsureMatchesDomain.php index 11b7289..bd03e48 100644 --- a/src/Pipeline/EnsureMatchesDomain.php +++ b/src/Pipeline/EnsureMatchesDomain.php @@ -13,9 +13,7 @@ class EnsureMatchesDomain /** * Create a new pipeline step instance. */ - public function __construct(protected Request $request, protected MountPath $mountPath) - { - } + public function __construct(protected Request $request, protected MountPath $mountPath) {} /** * Invoke the routing pipeline handler. @@ -29,7 +27,7 @@ public function __invoke(State $state, Closure $next): mixed $route = $this->route(); if ($this->matchesDomain($route) === false) { - return new StopIterating(); + return new StopIterating; } $state->data = array_merge($route->parameters(), $state->data); diff --git a/src/Pipeline/PotentiallyBindablePathSegment.php b/src/Pipeline/PotentiallyBindablePathSegment.php index db1b806..e5274be 100644 --- a/src/Pipeline/PotentiallyBindablePathSegment.php +++ b/src/Pipeline/PotentiallyBindablePathSegment.php @@ -29,9 +29,7 @@ class PotentiallyBindablePathSegment /** * Create a new potentially bindable path segment instance. */ - public function __construct(public string $value) - { - } + public function __construct(public string $value) {} /** * Determine if the segment is bindable. diff --git a/src/Pipeline/TransformModelBindings.php b/src/Pipeline/TransformModelBindings.php index 468f5ed..1f2ac62 100644 --- a/src/Pipeline/TransformModelBindings.php +++ b/src/Pipeline/TransformModelBindings.php @@ -11,9 +11,7 @@ class TransformModelBindings /** * Create a new pipeline step instance. */ - public function __construct(protected Request $request) - { - } + public function __construct(protected Request $request) {} /** * Invoke the routing pipeline handler. diff --git a/src/RequestHandler.php b/src/RequestHandler.php index 9e8db4c..be57a08 100644 --- a/src/RequestHandler.php +++ b/src/RequestHandler.php @@ -22,8 +22,7 @@ public function __construct( protected array $mountPaths, protected ?Closure $renderUsing = null, protected ?Closure $onViewMatch = null, - ) { - } + ) {} /** * Handle the incoming request using Folio. diff --git a/src/Router.php b/src/Router.php index 0533b9b..872a595 100644 --- a/src/Router.php +++ b/src/Router.php @@ -25,9 +25,7 @@ class Router /** * Create a new router instance. */ - public function __construct(protected MountPath $mountPath) - { - } + public function __construct(protected MountPath $mountPath) {} /** * Match the given URI to a view via page based routing. diff --git a/tests/Feature/Console/ListCommandTest.php b/tests/Feature/Console/ListCommandTest.php index a87eb53..a6e6a7e 100644 --- a/tests/Feature/Console/ListCommandTest.php +++ b/tests/Feature/Console/ListCommandTest.php @@ -18,7 +18,7 @@ }); it('may have routes', function () { - $output = new BufferedOutput(); + $output = new BufferedOutput; Folio::route(__DIR__.'/../resources/views/pages'); $exitCode = Artisan::call('folio:list', [], $output); @@ -53,7 +53,7 @@ }); it('has the `--json` option', function () { - $output = new BufferedOutput(); + $output = new BufferedOutput; Folio::route(__DIR__.'/../resources/views/pages'); $exitCode = Artisan::call('folio:list', [ @@ -67,7 +67,7 @@ }); it('has the `--path` option', function () { - $output = new BufferedOutput(); + $output = new BufferedOutput; Folio::route(__DIR__.'/../resources/views/pages'); $exitCode = Artisan::call('folio:list', [ @@ -91,7 +91,7 @@ }); it('has the `--name` option', function () { - $output = new BufferedOutput(); + $output = new BufferedOutput; Folio::route(__DIR__.'/../resources/views/pages'); $exitCode = Artisan::call('folio:list', [ @@ -111,7 +111,7 @@ }); it('has the `--except-path` option', function () { - $output = new BufferedOutput(); + $output = new BufferedOutput; Folio::route(__DIR__.'/../resources/views/pages'); $exitCode = Artisan::call('folio:list', [ @@ -142,7 +142,7 @@ }); it('may not find routes with `--path` or `--except-path`', function () { - $output = new BufferedOutput(); + $output = new BufferedOutput; Folio::route(__DIR__.'/../resources/views/pages'); $exitCode = Artisan::call('folio:list', [ @@ -160,7 +160,7 @@ }); it('has the `--sort` option', function () { - $output = new BufferedOutput(); + $output = new BufferedOutput; Folio::route(__DIR__.'/../resources/views/pages'); $exitCode = Artisan::call('folio:list', [ @@ -185,7 +185,7 @@ }); it('has the `--reverse` option', function () { - $output = new BufferedOutput(); + $output = new BufferedOutput; Folio::route(__DIR__.'/../resources/views/pages'); $exitCode = Artisan::call('folio:list', [ @@ -210,7 +210,7 @@ }); test('multiple mounted directories', function () { - $output = new BufferedOutput(); + $output = new BufferedOutput; Folio::path(__DIR__.'/../resources/views/pages'); Folio::path(__DIR__.'/../resources/views/more-pages'); @@ -250,7 +250,7 @@ }); it('prefixes URIs', function (string $uri) { - $output = new BufferedOutput(); + $output = new BufferedOutput; Folio::path(__DIR__.'/../resources/views/more-pages')->uri($uri); diff --git a/tests/Feature/MiddlewareTest.php b/tests/Feature/MiddlewareTest.php index a12d4de..7fbb09d 100644 --- a/tests/Feature/MiddlewareTest.php +++ b/tests/Feature/MiddlewareTest.php @@ -106,7 +106,7 @@ function ($request, $next) { }); test('terminate method is invoked using application container', function () { - $this->app->bind(Dependency::class, fn () => new Dependency()); + $this->app->bind(Dependency::class, fn () => new Dependency); $this->get('/users/Taylor'); diff --git a/tests/Unit/ModelBindingTest.php b/tests/Unit/ModelBindingTest.php index d058b1d..6ecca81 100644 --- a/tests/Unit/ModelBindingTest.php +++ b/tests/Unit/ModelBindingTest.php @@ -357,9 +357,7 @@ class FolioModelBindingTestClass implements UrlRoutable { public $trashed = false; - public function __construct(public mixed $value = null, public mixed $field = null, public mixed $childType = null) - { - } + public function __construct(public mixed $value = null, public mixed $field = null, public mixed $childType = null) {} public function getRouteKey() {