Skip to content

Commit a912268

Browse files
authored
Merge pull request #62 from dcblogdev/fix-phpstan-errors
Fix phpstan errors
2 parents 4663bcc + 4b16345 commit a912268

File tree

6 files changed

+6
-29
lines changed

6 files changed

+6
-29
lines changed

app/Http/Controllers/Admin/UploadController.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ public function __invoke(Request $request): JsonResponse
2929

3030
$file = $request->file('upload');
3131

32-
if (is_array($file)) {
33-
$file = $file[0];
34-
}
35-
3632
if (! $file instanceof UploadedFile) {
3733
return response()->json(['error' => 'Invalid upload'], 400);
3834
}

app/Livewire/Admin/AuditTrails.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function sortBy(string $field): void
7373
}
7474

7575
/**
76-
* @return LengthAwarePaginator<AuditTrail>
76+
* @return LengthAwarePaginator<int, AuditTrail>
7777
*/
7878
public function userLogs(): LengthAwarePaginator
7979
{

app/Livewire/Admin/Roles/Roles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function sortBy(string $field): void
4747
}
4848

4949
/**
50-
* @return LengthAwarePaginator<Role>
50+
* @return LengthAwarePaginator<int, Role>
5151
*/
5252
public function roles(): LengthAwarePaginator
5353
{

app/Livewire/Admin/Users/Users.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function sortBy(string $field): void
7171
}
7272

7373
/**
74-
* @return LengthAwarePaginator<User>
74+
* @return LengthAwarePaginator<int, User>
7575
*/
7676
public function users(): LengthAwarePaginator
7777
{

resources/views/livewire/admin/users/edit/change-password.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
<div class="card">
1111
<x-form wire:submit="update" method="put">
1212

13-
<x-alert>
14-
<p class="text-white">{{ __('New password must be at least 8 characters in length') }}<br>
13+
<x-alert class="text-white">
14+
<div>{{ __('New password must be at least 8 characters in length') }}<br>
1515
{{ __('at least one lowercase letter') }}<br>
1616
{{ __('at least one uppercase letter') }}<br>
17-
{{ __('at least one digit') }}</p>
17+
{{ __('at least one digit') }}</div>
1818
</x-alert>
1919

2020
<x-form.input wire:model="newPassword" type="password" :label="__('New Password')" name='newPassword' />

tests/Feature/App/Http/Controllers/Admin/UploadControllerTest.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,6 @@
2525
Storage::disk('images')->assertExists($path);
2626
});
2727

28-
test('handles valid upload when file is sent as an array', function () {
29-
$file = UploadedFile::fake()->image('photo.jpg');
30-
31-
$mockRequest = Mockery::mock(Request::class);
32-
$mockRequest->shouldReceive('validate')->andReturn(['upload' => [$file]]);
33-
$mockRequest->shouldReceive('hasFile')->once()->with('upload')->andReturn(true);
34-
$mockRequest->shouldReceive('file')->once()->with('upload')->andReturn([$file]);
35-
36-
$controller = new UploadController;
37-
38-
$response = $controller($mockRequest);
39-
40-
expect($response->getStatusCode())->toBe(200);
41-
expect($response->getData(true))->toHaveKey('url');
42-
43-
$path = str_replace('/images/', '', $response->getData(true)['url']);
44-
Storage::disk('images')->assertExists($path);
45-
});
46-
4728
test('fails when no file is uploaded', function () {
4829
postJson(route('image-upload'), [])->assertStatus(422);
4930
});

0 commit comments

Comments
 (0)