Skip to content

Commit 05fd86e

Browse files
committed
5.2.5
1 parent 250cd70 commit 05fd86e

18 files changed

+64
-50
lines changed

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
"php": "^8.1",
1717
"ext-json": "*",
1818
"brick/money": "^0.8|^0.9|^0.10",
19-
"illuminate/filesystem": "^10.48.23|^11.35",
20-
"illuminate/support": "^10.48.23|^11.35",
19+
"illuminate/filesystem": "^10.48.23|^11.35|^12.0",
20+
"illuminate/support": "^10.48.23|^11.35|^12.0",
2121
"inertiajs/inertia-laravel": "^1.3.2|^2.0",
22-
"laravel/fortify": "^1.25.3",
22+
"laravel/fortify": "^1.25.4",
2323
"nesbot/carbon": "^2.62.1|^3.4",
2424
"rap2hpoutre/fast-excel": "^5.4",
2525
"spatie/once": "^3.0",
@@ -33,16 +33,16 @@
3333
},
3434
"require-dev": {
3535
"doctrine/dbal": "^3.5.1|^4.0",
36-
"larastan/larastan": "^2.9.14",
36+
"larastan/larastan": "^2.9.14|^3.1",
3737
"laravel/pint": "^1.20",
38-
"laravel/scout": "^10.11",
39-
"orchestra/testbench-core": "^8.30|^9.7",
40-
"orchestra/testbench-dusk": "^8.32|^9.10",
41-
"orchestra/workbench": "^8.13|^9.9",
42-
"phpstan/phpstan": "^1.12.17",
38+
"laravel/scout": "^10.12.2",
39+
"orchestra/testbench-core": "^8.30|^9.7|^10.0",
40+
"orchestra/testbench-dusk": "^8.32|^9.10|^10.0",
41+
"orchestra/workbench": "^8.13|^9.9|^10.0",
42+
"phpstan/phpstan": "^1.12.17|^2.1",
4343
"phpunit/phpunit": "^10.5.35|^11.3.5",
4444
"predis/predis": "^2.3",
45-
"spatie/laravel-ray": "^1.39"
45+
"spatie/laravel-ray": "^1.39.1"
4646
},
4747
"autoload": {
4848
"psr-4": {
@@ -162,5 +162,5 @@
162162
},
163163
"minimum-stability": "dev",
164164
"prefer-stable": true,
165-
"version": "5.2.4"
165+
"version": "5.2.5"
166166
}

src/Actions/DispatchAction.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ public function dispatch(): Response
8888
* Dispatch the given action.
8989
*
9090
* @return $this
91-
*
92-
* @throws \Throwable
9391
*/
9492
public function handleStandalone(string $method)
9593
{
@@ -112,8 +110,6 @@ public function handleStandalone(string $method)
112110
* Dispatch the given action.
113111
*
114112
* @return $this
115-
*
116-
* @throws \Throwable
117113
*/
118114
public function handleRequest(ActionRequest $request, string $method, int $chunkCount)
119115
{

src/AuthorizedToSee.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ trait AuthorizedToSee
1010
/**
1111
* The callback used to authorize viewing the filter or action.
1212
*
13-
* @var (\Closure(\Illuminate\Http\Request):(bool))|null
13+
* @var (\Closure(\Laravel\Nova\Http\Requests\NovaRequest|\Illuminate\Http\Request):(bool))|null
1414
*/
1515
public $seeCallback = null;
1616

@@ -21,13 +21,15 @@ trait AuthorizedToSee
2121
*/
2222
public function authorizedToSee(Request $request)
2323
{
24-
return is_callable($this->seeCallback) ? call_user_func($this->seeCallback, $request) : true;
24+
return is_callable($this->seeCallback)
25+
? call_user_func($this->seeCallback, $request) // @phpstan-ignore argument.type
26+
: true;
2527
}
2628

2729
/**
2830
* Set the callback to be run to authorize viewing the filter or action.
2931
*
30-
* @param \Closure(\Illuminate\Http\Request):bool $callback
32+
* @param \Closure(\Laravel\Nova\Http\Requests\NovaRequest|\Illuminate\Http\Request):bool $callback
3133
* @return $this
3234
*/
3335
public function canSee(Closure $callback)

src/Concerns/InteractsWithActionEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static function actionEvent(): Model|ActionEvent
3434
public static function usingActionEvent(callable $callback): mixed
3535
{
3636
if (! is_null(config('nova.actions.resource'))) {
37-
return call_user_func($callback, static::actionEvent());
37+
return call_user_func($callback, static::actionEvent()); // @phpstan-ignore argument.type
3838
}
3939

4040
return null;

src/Console/ResourceCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function handle()
7171
'name' => 'Resource',
7272
]);
7373

74-
parent::handle();
74+
return parent::handle();
7575
}
7676

7777
/**

src/Fields/Attachments/DetachAnyAttachment.php

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

33
namespace Laravel\Nova\Fields\Attachments;
44

5-
use Illuminate\Http\Request;
5+
use Laravel\Nova\Http\Requests\NovaRequest;
66

77
class DetachAnyAttachment
88
{
99
/**
1010
* Delete any attachments from the field.
1111
*/
12-
public function __invoke(Request $request): void
12+
public function __invoke(NovaRequest $request): void
1313
{
1414
call_user_func(new DetachAttachment, $request);
1515
call_user_func(new DetachPendingAttachment, $request);

src/Fields/Badge.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,13 @@ public function resolveLabel(): Stringable|string
209209
/**
210210
* Resolve the display label for the Badge.
211211
*/
212-
protected function resolveLabelFor(string|int $value): Stringable|string
212+
protected function resolveLabelFor(string|int|null $value): Stringable|string
213213
{
214214
if (isset($this->labelCallback)) {
215215
return call_user_func($this->labelCallback, $value);
216216
}
217217

218-
return $this->labels[$value] ?? $value;
218+
return $this->labels[$value] ?? $value ?? '';
219219
}
220220

221221
/**

src/Fields/BelongsTo.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ public function getRules(NovaRequest $request): array
216216
)->toBase();
217217

218218
return array_merge_recursive(parent::getRules($request), [
219-
$this->attribute => array_filter([
219+
$this->attribute => [
220220
$this->nullable ? 'nullable' : 'required',
221221
new Relatable($request, $query, $this),
222-
]),
222+
],
223223
]);
224224
}
225225

src/Fields/FieldCollection.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,11 @@ public function withOnlyFilterableFields()
292292
return $this->whereInstanceOf(Field::class)
293293
->whereInstanceOf(FilterableField::class)
294294
->reject(static function ($field) {
295-
/** @var \Laravel\Nova\Fields\Field&\Laravel\Nova\Contracts\FilterableField $field */
295+
/**
296+
* @var \Laravel\Nova\Fields\Field&\Laravel\Nova\Contracts\FilterableField $field
297+
*
298+
* @phpstan-ignore varTag.nativeType
299+
*/
296300
return $field->isComputed() || is_null($field->filterableCallback);
297301
});
298302
}

src/Fields/FieldElement.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
use Laravel\Nova\Http\Requests\NovaRequest;
77
use Laravel\Nova\Panel;
88

9+
/**
10+
* @phpstan-type TMixedResource \Illuminate\Database\Eloquent\Model|\Laravel\Nova\Support\Fluent|object|array
11+
*/
912
abstract class FieldElement extends Element
1013
{
1114
/**
@@ -18,14 +21,18 @@ abstract class FieldElement extends Element
1821
/**
1922
* Indicates if the element should be shown on the index view.
2023
*
21-
* @var (callable():(bool))|bool
24+
* @var (callable(\Laravel\Nova\Http\Requests\NovaRequest, mixed):(bool))|bool
25+
*
26+
* @phpstan-var (callable(\Laravel\Nova\Http\Requests\NovaRequest, TMixedResource):(bool))|bool
2227
*/
2328
public $showOnIndex = true;
2429

2530
/**
2631
* Indicates if the element should be shown on the detail view.
2732
*
28-
* @var (callable():(bool))|bool
33+
* @var (callable(\Laravel\Nova\Http\Requests\NovaRequest, mixed):(bool))|bool
34+
*
35+
* @phpstan-var (callable(\Laravel\Nova\Http\Requests\NovaRequest, TMixedResource):(bool))|bool
2936
*/
3037
public $showOnDetail = true;
3138

@@ -110,8 +117,10 @@ public function hideWhenUpdating(callable|bool $callback = true)
110117
/**
111118
* Specify that the element should be visible on the index view.
112119
*
113-
* @param (callable():(bool))|bool $callback
120+
* @param (callable(\Laravel\Nova\Http\Requests\NovaRequest, mixed):(bool))|bool $callback
114121
* @return $this
122+
*
123+
* @phpstan-param (callable(\Laravel\Nova\Http\Requests\NovaRequest, TMixedResource):(bool))|bool $callback
115124
*/
116125
public function showOnIndex(callable|bool $callback = true)
117126
{
@@ -125,6 +134,8 @@ public function showOnIndex(callable|bool $callback = true)
125134
*
126135
* @param (callable(\Laravel\Nova\Http\Requests\NovaRequest, mixed):(bool))|bool $callback
127136
* @return $this
137+
*
138+
* @phpstan-param (callable(\Laravel\Nova\Http\Requests\NovaRequest, TMixedResource):(bool))|bool $callback
128139
*/
129140
public function showOnDetail(callable|bool $callback = true)
130141
{

0 commit comments

Comments
 (0)