Skip to content

Commit 7d702c6

Browse files
committed
Formatting
1 parent 9b26d03 commit 7d702c6

File tree

9 files changed

+36
-39
lines changed

9 files changed

+36
-39
lines changed

src/Commands/StartSsr.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function handle(): int
3636
return self::FAILURE;
3737
}
3838

39-
$bundle = (new BundleDetector())->detect();
39+
$bundle = (new BundleDetector)->detect();
4040
$configuredBundle = config('inertia.ssr.bundle');
4141

4242
if ($bundle === null) {

src/MergesProps.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Inertia;
44

5-
65
trait MergesProps
76
{
87
protected bool $merge = false;

src/Response.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ public function resolveProperties(Request $request, array $props): array
135135
{
136136
$isPartial = $this->isPartial($request);
137137

138-
if (!$isPartial) {
138+
if (! $isPartial) {
139139
$props = array_filter($this->props, static function ($prop) {
140-
return !($prop instanceof IgnoreFirstLoad);
140+
return ! ($prop instanceof IgnoreFirstLoad);
141141
});
142142
}
143143

@@ -239,7 +239,7 @@ public function resolvePropertyInstances(array $props, Request $request): array
239239
DeferProp::class,
240240
AlwaysProp::class,
241241
MergeProp::class,
242-
])->first(fn($class) => $value instanceof $class);
242+
])->first(fn ($class) => $value instanceof $class);
243243

244244
if ($resolveViaApp) {
245245
$value = App::call($value);
@@ -294,7 +294,7 @@ public function resolveMergeProps(Request $request): array
294294
return $prop->shouldMerge();
295295
})
296296
->filter(function ($prop, $key) use ($resetProps) {
297-
return !$resetProps->contains($key);
297+
return ! $resetProps->contains($key);
298298
})
299299
->keys();
300300

src/ServiceProvider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function register(): void
2323
$this->app->bind(Gateway::class, HttpGateway::class);
2424

2525
$this->mergeConfigFrom(
26-
__DIR__ . '/../config/inertia.php',
26+
__DIR__.'/../config/inertia.php',
2727
'inertia'
2828
);
2929

@@ -47,7 +47,7 @@ public function boot(): void
4747
$this->registerConsoleCommands();
4848

4949
$this->publishes([
50-
__DIR__ . '/../config/inertia.php' => config_path('inertia.php'),
50+
__DIR__.'/../config/inertia.php' => config_path('inertia.php'),
5151
]);
5252
}
5353

@@ -82,7 +82,7 @@ protected function registerRequestMacro(): void
8282
protected function registerRouterMacro(): void
8383
{
8484
Router::macro('inertia', function ($uri, $component, $props = []) {
85-
return $this->match(['GET', 'HEAD'], $uri, '\\' . Controller::class)
85+
return $this->match(['GET', 'HEAD'], $uri, '\\'.Controller::class)
8686
->defaults('component', $component)
8787
->defaults('props', $props);
8888
});
@@ -94,14 +94,14 @@ protected function registerRouterMacro(): void
9494
protected function registerTestingMacros(): void
9595
{
9696
if (class_exists(TestResponse::class)) {
97-
TestResponse::mixin(new TestResponseMacros());
97+
TestResponse::mixin(new TestResponseMacros);
9898

9999
return;
100100
}
101101

102102
// Laravel <= 6.0
103103
if (class_exists(LegacyTestResponse::class)) {
104-
LegacyTestResponse::mixin(new TestResponseMacros());
104+
LegacyTestResponse::mixin(new TestResponseMacros);
105105

106106
return;
107107
}

src/Ssr/HttpGateway.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class HttpGateway implements Gateway
1212
*/
1313
public function dispatch(array $page): ?Response
1414
{
15-
if (! config('inertia.ssr.enabled', true) || ! (new BundleDetector())->detect()) {
15+
if (! config('inertia.ssr.enabled', true) || ! (new BundleDetector)->detect()) {
1616
return null;
1717
}
1818

src/Ssr/SsrException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@
44

55
use Exception;
66

7-
class SsrException extends Exception
8-
{
9-
}
7+
class SsrException extends Exception {}

tests/DirectiveTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function setUp(): void
3939
$this->app->bind(Gateway::class, FakeGateway::class);
4040
$this->filesystem = m::mock(Filesystem::class);
4141

42-
$this->compiler = new BladeCompiler($this->filesystem, __DIR__ . '/cache/views');
42+
$this->compiler = new BladeCompiler($this->filesystem, __DIR__.'/cache/views');
4343
$this->compiler->directive('inertia', [Directive::class, 'compile']);
4444
$this->compiler->directive('inertiaHead', [Directive::class, 'compileHead']);
4545
}
@@ -65,7 +65,7 @@ protected function renderView($contents, $data = [])
6565
// Next, we'll 'render' out compiled view.
6666
$view = new View(
6767
m::mock(Factory::class),
68-
new PhpEngine(new Filesystem()),
68+
new PhpEngine(new Filesystem),
6969
'fake-view',
7070
$path,
7171
$data
@@ -143,7 +143,7 @@ public function test_inertia_head_directive_renders_server_side_rendered_head_el
143143
public function test_the_server_side_rendering_request_is_dispatched_only_once_per_request(): void
144144
{
145145
Config::set(['inertia.ssr.enabled' => true]);
146-
$this->app->instance(Gateway::class, $gateway = new FakeGateway());
146+
$this->app->instance(Gateway::class, $gateway = new FakeGateway);
147147

148148
$view = "<!DOCTYPE html>\n<html>\n<head>\n@inertiaHead\n</head>\n<body>\n@inertia\n</body>\n</html>";
149149
$expected = "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\" />\n<title inertia>Example SSR Title</title>\n</head>\n<body>\n<p>This is some example SSR content</p></body>\n</html>";

tests/MiddlewareTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function test_validation_errors_can_be_empty(): void
145145

146146
public function test_validation_errors_are_returned_in_the_correct_format(): void
147147
{
148-
Session::put('errors', (new ViewErrorBag())->put('default', new MessageBag([
148+
Session::put('errors', (new ViewErrorBag)->put('default', new MessageBag([
149149
'name' => 'The name field is required.',
150150
'email' => 'Not a valid email address.',
151151
])));
@@ -163,7 +163,7 @@ public function test_validation_errors_are_returned_in_the_correct_format(): voi
163163

164164
public function test_validation_errors_with_named_error_bags_are_scoped(): void
165165
{
166-
Session::put('errors', (new ViewErrorBag())->put('example', new MessageBag([
166+
Session::put('errors', (new ViewErrorBag)->put('example', new MessageBag([
167167
'name' => 'The name field is required.',
168168
'email' => 'Not a valid email address.',
169169
])));
@@ -181,7 +181,7 @@ public function test_validation_errors_with_named_error_bags_are_scoped(): void
181181

182182
public function test_default_validation_errors_can_be_overwritten(): void
183183
{
184-
Session::put('errors', (new ViewErrorBag())->put('example', new MessageBag([
184+
Session::put('errors', (new ViewErrorBag)->put('example', new MessageBag([
185185
'name' => 'The name field is required.',
186186
'email' => 'Not a valid email address.',
187187
])));
@@ -198,7 +198,7 @@ public function test_default_validation_errors_can_be_overwritten(): void
198198

199199
public function test_validation_errors_are_scoped_to_error_bag_header(): void
200200
{
201-
Session::put('errors', (new ViewErrorBag())->put('default', new MessageBag([
201+
Session::put('errors', (new ViewErrorBag)->put('default', new MessageBag([
202202
'name' => 'The name field is required.',
203203
'email' => 'Not a valid email address.',
204204
])));
@@ -216,7 +216,7 @@ public function test_validation_errors_are_scoped_to_error_bag_header(): void
216216

217217
public function test_middleware_can_change_the_root_view_via_a_property(): void
218218
{
219-
$this->prepareMockEndpoint(null, [], new class() extends Middleware
219+
$this->prepareMockEndpoint(null, [], new class extends Middleware
220220
{
221221
protected $rootView = 'welcome';
222222
});
@@ -228,7 +228,7 @@ public function test_middleware_can_change_the_root_view_via_a_property(): void
228228

229229
public function test_middleware_can_change_the_root_view_by_overriding_the_rootview_method(): void
230230
{
231-
$this->prepareMockEndpoint(null, [], new class() extends Middleware
231+
$this->prepareMockEndpoint(null, [], new class extends Middleware
232232
{
233233
public function rootView(Request $request): string
234234
{

tests/ResponseFactoryTest.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ResponseFactoryTest extends TestCase
2424
{
2525
public function test_can_macro(): void
2626
{
27-
$factory = new ResponseFactory();
27+
$factory = new ResponseFactory;
2828
$factory->macro('foo', function () {
2929
return 'bar';
3030
});
@@ -38,7 +38,7 @@ public function test_location_response_for_inertia_requests(): void
3838
return true;
3939
});
4040

41-
$response = (new ResponseFactory())->location('https://inertiajs.com');
41+
$response = (new ResponseFactory)->location('https://inertiajs.com');
4242

4343
$this->assertInstanceOf(Response::class, $response);
4444
$this->assertEquals(Response::HTTP_CONFLICT, $response->getStatusCode());
@@ -51,7 +51,7 @@ public function test_location_response_for_non_inertia_requests(): void
5151
return false;
5252
});
5353

54-
$response = (new ResponseFactory())->location('https://inertiajs.com');
54+
$response = (new ResponseFactory)->location('https://inertiajs.com');
5555

5656
$this->assertInstanceOf(RedirectResponse::class, $response);
5757
$this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
@@ -65,7 +65,7 @@ public function test_location_response_for_inertia_requests_using_redirect_respo
6565
});
6666

6767
$redirect = new RedirectResponse('https://inertiajs.com');
68-
$response = (new ResponseFactory())->location($redirect);
68+
$response = (new ResponseFactory)->location($redirect);
6969

7070
$this->assertInstanceOf(Response::class, $response);
7171
$this->assertEquals(409, $response->getStatusCode());
@@ -75,7 +75,7 @@ public function test_location_response_for_inertia_requests_using_redirect_respo
7575
public function test_location_response_for_non_inertia_requests_using_redirect_response(): void
7676
{
7777
$redirect = new RedirectResponse('https://inertiajs.com');
78-
$response = (new ResponseFactory())->location($redirect);
78+
$response = (new ResponseFactory)->location($redirect);
7979

8080
$this->assertInstanceOf(RedirectResponse::class, $response);
8181
$this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
@@ -84,7 +84,7 @@ public function test_location_response_for_non_inertia_requests_using_redirect_r
8484

8585
public function test_location_redirects_are_not_modified(): void
8686
{
87-
$response = (new ResponseFactory())->location('/foo');
87+
$response = (new ResponseFactory)->location('/foo');
8888

8989
$this->assertInstanceOf(RedirectResponse::class, $response);
9090
$this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
@@ -96,7 +96,7 @@ public function test_location_response_for_non_inertia_requests_using_redirect_r
9696
$redirect = new RedirectResponse('https://inertiajs.com');
9797
$redirect->setSession($session = new Store('test', new NullSessionHandler));
9898
$redirect->setRequest($request = new HttpRequest);
99-
$response = (new ResponseFactory())->location($redirect);
99+
$response = (new ResponseFactory)->location($redirect);
100100

101101
$this->assertInstanceOf(RedirectResponse::class, $response);
102102
$this->assertEquals(Response::HTTP_FOUND, $response->getStatusCode());
@@ -156,7 +156,7 @@ public function test_can_flush_shared_data(): void
156156

157157
public function test_can_create_lazy_prop(): void
158158
{
159-
$factory = new ResponseFactory();
159+
$factory = new ResponseFactory;
160160
$lazyProp = $factory->lazy(function () {
161161
return 'A lazy value';
162162
});
@@ -166,7 +166,7 @@ public function test_can_create_lazy_prop(): void
166166

167167
public function test_can_create_deferred_prop(): void
168168
{
169-
$factory = new ResponseFactory();
169+
$factory = new ResponseFactory;
170170
$deferredProp = $factory->defer(function () {
171171
return 'A deferred value';
172172
});
@@ -177,7 +177,7 @@ public function test_can_create_deferred_prop(): void
177177

178178
public function test_can_create_deferred_prop_with_custom_group(): void
179179
{
180-
$factory = new ResponseFactory();
180+
$factory = new ResponseFactory;
181181
$deferredProp = $factory->defer(function () {
182182
return 'A deferred value';
183183
}, 'foo');
@@ -188,7 +188,7 @@ public function test_can_create_deferred_prop_with_custom_group(): void
188188

189189
public function test_can_create_merged_prop(): void
190190
{
191-
$factory = new ResponseFactory();
191+
$factory = new ResponseFactory;
192192
$mergedProp = $factory->merge(function () {
193193
return 'A merged value';
194194
});
@@ -198,7 +198,7 @@ public function test_can_create_merged_prop(): void
198198

199199
public function test_can_create_deferred_and_merged_prop(): void
200200
{
201-
$factory = new ResponseFactory();
201+
$factory = new ResponseFactory;
202202
$deferredProp = $factory->defer(function () {
203203
return 'A deferred + merged value';
204204
})->merge();
@@ -208,7 +208,7 @@ public function test_can_create_deferred_and_merged_prop(): void
208208

209209
public function test_can_create_optional_prop(): void
210210
{
211-
$factory = new ResponseFactory();
211+
$factory = new ResponseFactory;
212212
$optionalProp = $factory->optional(function () {
213213
return 'An optional value';
214214
});
@@ -218,7 +218,7 @@ public function test_can_create_optional_prop(): void
218218

219219
public function test_can_create_always_prop(): void
220220
{
221-
$factory = new ResponseFactory();
221+
$factory = new ResponseFactory;
222222
$alwaysProp = $factory->always(function () {
223223
return 'An always value';
224224
});
@@ -231,7 +231,7 @@ public function test_will_accept_arrayabe_props()
231231
Route::middleware([StartSession::class, ExampleMiddleware::class])->get('/', function () {
232232
Inertia::share('foo', 'bar');
233233

234-
return Inertia::render('User/Edit', new class() implements Arrayable
234+
return Inertia::render('User/Edit', new class implements Arrayable
235235
{
236236
public function toArray()
237237
{

0 commit comments

Comments
 (0)