Skip to content

Commit a720de1

Browse files
committed
Install and run Pint
1 parent 5cbaeab commit a720de1

30 files changed

+136
-150
lines changed

.php-cs-fixer.dist.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66

77
## [v1.2.0](https://github.com/inertiajs/inertia-laravel/compare/v1.1.0...v1.2.0) - 2024-05-17
88

9-
* [1.x] Make commands lazy by [@timacdonald](https://github.com/timacdonald) in https://github.com/inertiajs/inertia-laravel/pull/601
10-
* [1.x] Persistent properties by [@lepikhinb](https://github.com/lepikhinb) in https://github.com/inertiajs/inertia-laravel/pull/621
11-
* [1.x] Exclude properties from partial responses by [@lepikhinb](https://github.com/lepikhinb) in https://github.com/inertiajs/inertia-laravel/pull/622
9+
- Make commands lazy by [@timacdonald](https://github.com/timacdonald) in https://github.com/inertiajs/inertia-laravel/pull/601
10+
- Persistent properties by [@lepikhinb](https://github.com/lepikhinb) in https://github.com/inertiajs/inertia-laravel/pull/621
11+
- Exclude properties from partial responses by [@lepikhinb](https://github.com/lepikhinb) in https://github.com/inertiajs/inertia-laravel/pull/622
1212

1313
## [v1.1.0](https://github.com/inertiajs/inertia-laravel/compare/v1.0.0...v1.1.0) - 2024-05-16
1414

15-
* Support dot notation in partial requests by [@lepikhinb](https://github.com/lepikhinb) in https://github.com/inertiajs/inertia-laravel/pull/620
16-
* [1.x] Add `$request->inertia()` IDE helper by [@ycs77](https://github.com/ycs77) in https://github.com/inertiajs/inertia-laravel/pull/625
15+
- Support dot notation in partial requests by [@lepikhinb](https://github.com/lepikhinb) in https://github.com/inertiajs/inertia-laravel/pull/620
16+
- Add `$request->inertia()` IDE helper by [@ycs77](https://github.com/ycs77) in https://github.com/inertiajs/inertia-laravel/pull/625
1717

1818
## [v1.0.0](https://github.com/inertiajs/inertia-laravel/compare/v0.6.11...v1.0.0) - 2024-03-08
1919

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"roave/security-advisories": "dev-master",
3535
"orchestra/testbench": "^6.4|^7.0|^8.0|^9.0",
3636
"mockery/mockery": "^1.3.3",
37-
"phpunit/phpunit": "^8.0|^9.5.8|^10.4"
37+
"phpunit/phpunit": "^8.0|^9.5.8|^10.4",
38+
"laravel/pint": "^1.16"
3839
},
3940
"suggest": {
4041
"ext-pcntl": "Recommended when running the Inertia SSR server via the `inertia:start-ssr` artisan command."

src/AlwaysProp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class AlwaysProp
1010
protected $value;
1111

1212
/**
13-
* @param mixed $value
13+
* @param mixed $value
1414
*/
1515
public function __construct($value)
1616
{

src/Commands/CreateMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function getStub(): string
4141
/**
4242
* Get the default namespace for the class.
4343
*
44-
* @param string $rootNamespace
44+
* @param string $rootNamespace
4545
*/
4646
protected function getDefaultNamespace($rootNamespace): string
4747
{

src/Commands/StartSsr.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Inertia\Commands;
44

5-
use Inertia\Ssr\SsrException;
65
use Illuminate\Console\Command;
76
use Inertia\Ssr\BundleDetector;
7+
use Inertia\Ssr\SsrException;
88
use Symfony\Component\Console\Attribute\AsCommand;
99
use Symfony\Component\Process\Process;
1010

src/Directive.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Directive
77
/**
88
* Compiles the "@inertia" directive.
99
*
10-
* @param string $expression
10+
* @param string $expression
1111
*/
1212
public static function compile($expression = ''): string
1313
{
@@ -32,7 +32,7 @@ public static function compile($expression = ''): string
3232
/**
3333
* Compiles the "@inertiaHead" directive.
3434
*
35-
* @param string $expression
35+
* @param string $expression
3636
*/
3737
public static function compileHead($expression = ''): string
3838
{

src/Response.php

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

55
use Closure;
6-
use Illuminate\Http\Request;
7-
use Illuminate\Http\JsonResponse;
8-
use Illuminate\Support\Facades\App;
9-
use Illuminate\Support\Str;
106
use GuzzleHttp\Promise\PromiseInterface;
11-
use Illuminate\Support\Traits\Macroable;
127
use Illuminate\Contracts\Support\Arrayable;
138
use Illuminate\Contracts\Support\Responsable;
9+
use Illuminate\Http\JsonResponse;
10+
use Illuminate\Http\Request;
1411
use Illuminate\Http\Resources\Json\JsonResource;
1512
use Illuminate\Http\Resources\Json\ResourceResponse;
1613
use Illuminate\Support\Arr;
14+
use Illuminate\Support\Facades\App;
1715
use Illuminate\Support\Facades\Response as ResponseFactory;
16+
use Illuminate\Support\Str;
17+
use Illuminate\Support\Traits\Macroable;
1818
use Inertia\Support\Header;
1919

2020
class Response implements Responsable
2121
{
2222
use Macroable;
2323

2424
protected $component;
25+
2526
protected $props;
27+
2628
protected $rootView;
29+
2730
protected $version;
31+
2832
protected $viewData = [];
2933

3034
/**
31-
* @param array|Arrayable $props
35+
* @param array|Arrayable $props
3236
*/
3337
public function __construct(string $component, array $props, string $rootView = 'app', string $version = '')
3438
{
@@ -39,9 +43,8 @@ public function __construct(string $component, array $props, string $rootView =
3943
}
4044

4145
/**
42-
* @param string|array $key
43-
* @param mixed $value
44-
*
46+
* @param string|array $key
47+
* @param mixed $value
4548
* @return $this
4649
*/
4750
public function with($key, $value = null): self
@@ -56,9 +59,8 @@ public function with($key, $value = null): self
5659
}
5760

5861
/**
59-
* @param string|array $key
60-
* @param mixed $value
61-
*
62+
* @param string|array $key
63+
* @param mixed $value
6264
* @return $this
6365
*/
6466
public function withViewData($key, $value = null): self
@@ -82,8 +84,7 @@ public function rootView(string $rootView): self
8284
/**
8385
* Create an HTTP response that represents the object.
8486
*
85-
* @param \Illuminate\Http\Request $request
86-
*
87+
* @param \Illuminate\Http\Request $request
8788
* @return \Symfony\Component\HttpFoundation\Response
8889
*/
8990
public function toResponse($request)
@@ -111,19 +112,19 @@ public function resolveProperties(Request $request, array $props): array
111112
{
112113
$isPartial = $request->header(Header::PARTIAL_COMPONENT) === $this->component;
113114

114-
if(! $isPartial) {
115+
if (! $isPartial) {
115116
$props = array_filter($this->props, static function ($prop) {
116117
return ! ($prop instanceof LazyProp);
117118
});
118119
}
119120

120121
$props = $this->resolveArrayableProperties($props, $request);
121122

122-
if($isPartial && $request->hasHeader(Header::PARTIAL_ONLY)) {
123+
if ($isPartial && $request->hasHeader(Header::PARTIAL_ONLY)) {
123124
$props = $this->resolveOnly($request, $props);
124125
}
125126

126-
if($isPartial && $request->hasHeader(Header::PARTIAL_EXCEPT)) {
127+
if ($isPartial && $request->hasHeader(Header::PARTIAL_EXCEPT)) {
127128
$props = $this->resolveExcept($request, $props);
128129
}
129130

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

169170
$value = [];
170171

171-
foreach($only as $key) {
172+
foreach ($only as $key) {
172173
Arr::set($value, $key, data_get($props, $key));
173174
}
174175

src/ResponseFactory.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
namespace Inertia;
44

55
use Closure;
6+
use Illuminate\Contracts\Support\Arrayable;
67
use Illuminate\Support\Arr;
78
use Illuminate\Support\Facades\App;
8-
use Illuminate\Support\Facades\Request;
9-
use Illuminate\Support\Traits\Macroable;
10-
use Illuminate\Contracts\Support\Arrayable;
119
use Illuminate\Support\Facades\Redirect;
10+
use Illuminate\Support\Facades\Request;
1211
use Illuminate\Support\Facades\Response as BaseResponse;
12+
use Illuminate\Support\Traits\Macroable;
1313
use Inertia\Support\Header;
14-
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
1514
use Symfony\Component\HttpFoundation\RedirectResponse as SymfonyRedirect;
15+
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
1616

1717
class ResponseFactory
1818
{
@@ -33,8 +33,8 @@ public function setRootView(string $name): void
3333
}
3434

3535
/**
36-
* @param string|array|Arrayable $key
37-
* @param mixed $value
36+
* @param string|array|Arrayable $key
37+
* @param mixed $value
3838
*/
3939
public function share($key, $value = null): void
4040
{
@@ -48,11 +48,10 @@ public function share($key, $value = null): void
4848
}
4949

5050
/**
51-
* @param mixed $default
52-
*
51+
* @param mixed $default
5352
* @return mixed
5453
*/
55-
public function getShared(string $key = null, $default = null)
54+
public function getShared(?string $key = null, $default = null)
5655
{
5756
if ($key) {
5857
return Arr::get($this->sharedProps, $key, $default);
@@ -67,7 +66,7 @@ public function flushShared(): void
6766
}
6867

6968
/**
70-
* @param Closure|string|null $version
69+
* @param Closure|string|null $version
7170
*/
7271
public function version($version): void
7372
{
@@ -89,15 +88,15 @@ public function lazy(callable $callback): LazyProp
8988
}
9089

9190
/**
92-
* @param mixed $value
91+
* @param mixed $value
9392
*/
9493
public function always($value): AlwaysProp
9594
{
9695
return new AlwaysProp($value);
9796
}
9897

9998
/**
100-
* @param array|Arrayable $props
99+
* @param array|Arrayable $props
101100
*/
102101
public function render(string $component, $props = []): Response
103102
{
@@ -114,7 +113,7 @@ public function render(string $component, $props = []): Response
114113
}
115114

116115
/**
117-
* @param string|SymfonyRedirect $url
116+
* @param string|SymfonyRedirect $url
118117
*/
119118
public function location($url): SymfonyResponse
120119
{

src/ServiceProvider.php

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

33
namespace Inertia;
44

5-
use LogicException;
6-
use Inertia\Ssr\Gateway;
7-
use ReflectionException;
5+
use Illuminate\Foundation\Testing\TestResponse as LegacyTestResponse;
86
use Illuminate\Http\Request;
9-
use Inertia\Ssr\HttpGateway;
107
use Illuminate\Routing\Router;
11-
use Illuminate\View\FileViewFinder;
12-
use Illuminate\Testing\TestResponse;
13-
use Inertia\Testing\TestResponseMacros;
148
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
15-
use Illuminate\Foundation\Testing\TestResponse as LegacyTestResponse;
9+
use Illuminate\Testing\TestResponse;
10+
use Illuminate\View\FileViewFinder;
11+
use Inertia\Ssr\Gateway;
12+
use Inertia\Ssr\HttpGateway;
1613
use Inertia\Support\Header;
14+
use Inertia\Testing\TestResponseMacros;
15+
use LogicException;
16+
use ReflectionException;
1717

1818
class ServiceProvider extends BaseServiceProvider
1919
{

0 commit comments

Comments
 (0)