Skip to content

Commit 96a9619

Browse files
committed
Formatting cleanups
1 parent 5cbaeab commit 96a9619

14 files changed

+27
-46
lines changed

src/AlwaysProp.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66

77
class AlwaysProp
88
{
9-
/** @var mixed */
109
protected $value;
1110

12-
/**
13-
* @param mixed $value
14-
*/
1511
public function __construct($value)
1612
{
1713
$this->value = $value;

src/Commands/CreateMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Inertia\Commands;
44

55
use Illuminate\Console\GeneratorCommand;
6-
use Symfony\Component\Console\Attribute\AsCommand;
76
use Symfony\Component\Console\Input\InputOption;
7+
use Symfony\Component\Console\Attribute\AsCommand;
88

99
#[AsCommand(name: 'inertia:middleware')]
1010
class CreateMiddleware extends GeneratorCommand

src/Commands/StartSsr.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
use Inertia\Ssr\SsrException;
66
use Illuminate\Console\Command;
77
use Inertia\Ssr\BundleDetector;
8-
use Symfony\Component\Console\Attribute\AsCommand;
98
use Symfony\Component\Process\Process;
9+
use Symfony\Component\Console\Attribute\AsCommand;
1010

1111
#[AsCommand(name: 'inertia:start-ssr')]
1212
class StartSsr extends Command

src/Middleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace Inertia;
44

55
use Closure;
6+
use Inertia\Support\Header;
67
use Illuminate\Http\Request;
78
use Illuminate\Support\Facades\Redirect;
8-
use Inertia\Support\Header;
99
use Symfony\Component\HttpFoundation\Response;
1010

1111
class Middleware

src/Response.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
namespace Inertia;
44

55
use Closure;
6+
use Illuminate\Support\Arr;
7+
use Illuminate\Support\Str;
8+
use Inertia\Support\Header;
69
use Illuminate\Http\Request;
710
use Illuminate\Http\JsonResponse;
811
use Illuminate\Support\Facades\App;
9-
use Illuminate\Support\Str;
1012
use GuzzleHttp\Promise\PromiseInterface;
1113
use Illuminate\Support\Traits\Macroable;
1214
use Illuminate\Contracts\Support\Arrayable;
1315
use Illuminate\Contracts\Support\Responsable;
1416
use Illuminate\Http\Resources\Json\JsonResource;
1517
use Illuminate\Http\Resources\Json\ResourceResponse;
16-
use Illuminate\Support\Arr;
1718
use Illuminate\Support\Facades\Response as ResponseFactory;
18-
use Inertia\Support\Header;
1919

2020
class Response implements Responsable
2121
{
@@ -40,7 +40,6 @@ public function __construct(string $component, array $props, string $rootView =
4040

4141
/**
4242
* @param string|array $key
43-
* @param mixed $value
4443
*
4544
* @return $this
4645
*/
@@ -57,7 +56,6 @@ public function with($key, $value = null): self
5756

5857
/**
5958
* @param string|array $key
60-
* @param mixed $value
6159
*
6260
* @return $this
6361
*/
@@ -111,19 +109,19 @@ public function resolveProperties(Request $request, array $props): array
111109
{
112110
$isPartial = $request->header(Header::PARTIAL_COMPONENT) === $this->component;
113111

114-
if(! $isPartial) {
112+
if (! $isPartial) {
115113
$props = array_filter($this->props, static function ($prop) {
116114
return ! ($prop instanceof LazyProp);
117115
});
118116
}
119117

120118
$props = $this->resolveArrayableProperties($props, $request);
121119

122-
if($isPartial && $request->hasHeader(Header::PARTIAL_ONLY)) {
120+
if ($isPartial && $request->hasHeader(Header::PARTIAL_ONLY)) {
123121
$props = $this->resolveOnly($request, $props);
124122
}
125123

126-
if($isPartial && $request->hasHeader(Header::PARTIAL_EXCEPT)) {
124+
if ($isPartial && $request->hasHeader(Header::PARTIAL_EXCEPT)) {
127125
$props = $this->resolveExcept($request, $props);
128126
}
129127

@@ -168,7 +166,7 @@ public function resolveOnly(Request $request, array $props): array
168166

169167
$value = [];
170168

171-
foreach($only as $key) {
169+
foreach ($only as $key) {
172170
Arr::set($value, $key, data_get($props, $key));
173171
}
174172

src/ResponseFactory.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
use Closure;
66
use Illuminate\Support\Arr;
7+
use Inertia\Support\Header;
78
use Illuminate\Support\Facades\App;
89
use Illuminate\Support\Facades\Request;
10+
use Illuminate\Support\Facades\Redirect;
911
use Illuminate\Support\Traits\Macroable;
1012
use Illuminate\Contracts\Support\Arrayable;
11-
use Illuminate\Support\Facades\Redirect;
1213
use Illuminate\Support\Facades\Response as BaseResponse;
13-
use Inertia\Support\Header;
1414
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
1515
use Symfony\Component\HttpFoundation\RedirectResponse as SymfonyRedirect;
1616

@@ -34,7 +34,6 @@ public function setRootView(string $name): void
3434

3535
/**
3636
* @param string|array|Arrayable $key
37-
* @param mixed $value
3837
*/
3938
public function share($key, $value = null): void
4039
{
@@ -47,11 +46,6 @@ public function share($key, $value = null): void
4746
}
4847
}
4948

50-
/**
51-
* @param mixed $default
52-
*
53-
* @return mixed
54-
*/
5549
public function getShared(string $key = null, $default = null)
5650
{
5751
if ($key) {
@@ -88,9 +82,6 @@ public function lazy(callable $callback): LazyProp
8882
return new LazyProp($callback);
8983
}
9084

91-
/**
92-
* @param mixed $value
93-
*/
9485
public function always($value): AlwaysProp
9586
{
9687
return new AlwaysProp($value);

src/ServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use LogicException;
66
use Inertia\Ssr\Gateway;
77
use ReflectionException;
8+
use Inertia\Support\Header;
89
use Illuminate\Http\Request;
910
use Inertia\Ssr\HttpGateway;
1011
use Illuminate\Routing\Router;
@@ -13,7 +14,6 @@
1314
use Inertia\Testing\TestResponseMacros;
1415
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
1516
use Illuminate\Foundation\Testing\TestResponse as LegacyTestResponse;
16-
use Inertia\Support\Header;
1717

1818
class ServiceProvider extends BaseServiceProvider
1919
{

src/Testing/Concerns/Has.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ public function hasAll($key): self
3636
}
3737

3838
/**
39-
* @param mixed $value
40-
*
4139
* @return $this
4240
*/
4341
public function has(string $key, $value = null, Closure $scope = null): self

tests/AlwaysPropTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Inertia\Tests;
44

5-
use Illuminate\Http\Request;
65
use Inertia\AlwaysProp;
6+
use Illuminate\Http\Request;
77

88
class AlwaysPropTest extends TestCase
99
{
@@ -25,8 +25,9 @@ public function test_can_accept_scalar_values(): void
2525

2626
public function test_can_accept_callables(): void
2727
{
28-
$callable = new class {
29-
public function __invoke() {
28+
$callable = new class() {
29+
public function __invoke()
30+
{
3031
return 'An always value';
3132
}
3233
};

tests/MiddlewareTest.php

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

55
use LogicException;
66
use Inertia\Inertia;
7+
use Inertia\AlwaysProp;
78
use Inertia\Middleware;
89
use Illuminate\Http\Request;
910
use Illuminate\Support\MessageBag;
@@ -12,7 +13,6 @@
1213
use Illuminate\Support\Facades\Session;
1314
use Inertia\Tests\Stubs\ExampleMiddleware;
1415
use Illuminate\Session\Middleware\StartSession;
15-
use Inertia\AlwaysProp;
1616

1717
class MiddlewareTest extends TestCase
1818
{

0 commit comments

Comments
 (0)