Skip to content

Commit bef79c0

Browse files
authored
fix(LAR-73): failed tests (#159)
1 parent 137d007 commit bef79c0

File tree

13 files changed

+27
-174
lines changed

13 files changed

+27
-174
lines changed

app/Actions/Replies/CreateReply.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,9 @@
99
use App\Models\Reply;
1010
use App\Models\User;
1111
use Illuminate\Database\Eloquent\Model;
12-
use Lorisleiva\Actions\Concerns\AsAction;
1312

1413
final class CreateReply
1514
{
16-
use AsAction;
17-
1815
public function handle(string $body, User $user, Model $model): Reply
1916
{
2017
$reply = new Reply(['body' => $body]);

app/Actions/Replies/LikeReply.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
use App\Models\Reaction;
88
use App\Models\Reply;
99
use App\Models\User;
10-
use Lorisleiva\Actions\Concerns\AsAction;
1110

1211
final class LikeReply
1312
{
14-
use AsAction;
15-
1613
public function handle(User $user, Reply $reply, string $reaction = 'love'): void
1714
{
18-
$react = Reaction::where('name', $reaction)->first();
15+
/** @var Reaction $react */
16+
$react = Reaction::query()->where('name', $reaction)->first();
1917

2018
$user->reactTo($reply, $react);
2119
}

app/Livewire/Discussions/AddComment.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use App\Models\Discussion;
99
use Filament\Notifications\Notification;
1010
use Illuminate\Contracts\View\View;
11+
use Illuminate\Support\Facades\Auth;
1112
use Livewire\Component;
1213

1314
final class AddComment extends Component
@@ -32,7 +33,7 @@ public function saveComment(): void
3233
['body.required' => __('Votre commentaire ne peut pas être vide')]
3334
);
3435

35-
$comment = CreateReply::run($this->body, auth()->user(), $this->discussion);
36+
$comment = app(CreateReply::class)->handle($this->body, Auth::user(), $this->discussion); // @phpstan-ignore-line
3637

3738
$this->dispatch('$refresh')->self();
3839

app/Livewire/Discussions/Comment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function toggleLike(): void
4040
return;
4141
}
4242

43-
LikeReply::run(auth()->user(), $this->comment);
43+
app(LikeReply::class)->handle(auth()->user(), $this->comment); // @phpstan-ignore-line
4444

4545
$this->dispatch('reloadComment')->self();
4646
}

app/Livewire/MarkdownX.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function upload(array $payload): void
131131
@[, $file_data] = explode(',', $file_data);
132132
$type = explode('/', $type)[1];
133133

134-
if ( ! in_array($type, config('markdownx.image.allowed_file_types'))) {
134+
if (! in_array($type, config('markdownx.image.allowed_file_types'))) {
135135
$this->dispatch('markdown-x-image-uploaded', [
136136
'status' => 400,
137137
'message' => 'File type not supported. Must be of type '.implode(', ', config('markdownx.image.allowed_file_types')),

app/Models/User.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ public static function findOrCreateSocialUserProvider(SocialUser $socialUser, st
207207
'name' => $socialUser->getName() ?? $socialUser->getNickName() ?? $socialUser->getId(),
208208
'email' => $socialEmail,
209209
'username' => $socialUser->getNickName() ?? $socialUser->getId(),
210-
'github_profile' => 'github' === $provider ? $socialUser->getNickName() : null,
211-
'twitter_profile' => 'twitter' === $provider ? $socialUser->getNickName() : null,
210+
'github_profile' => $provider === 'github' ? $socialUser->getNickName() : null,
211+
'twitter_profile' => $provider === 'twitter' ? $socialUser->getNickName() : null,
212212
'email_verified_at' => now(),
213213
'avatar_type' => $provider,
214214
]);
@@ -425,7 +425,6 @@ public function scopeMostSolutionsInLastDays(Builder $query, int $days): Builder
425425
* Scope for most submissions in the last days.
426426
*
427427
* @param Builder<User> $query
428-
* @param int $days
429428
* @return Builder<User>
430429
*/
431430
public function scopeMostSubmissionsInLastDays(Builder $query, int $days): Builder

composer.lock

Lines changed: 1 addition & 149 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ parameters:
1515
- app/Markdown/MarkdownHelper.php
1616
ignoreErrors:
1717
- "#^Cannot access property \\$transaction on array\\|object\\.$#"
18-
checkGenericClassInNonGenericObjectType: false
19-
checkMissingIterableValueType: false
18+
- identifier: missingType.iterableValue
19+
- identifier: missingType.generics

resources/views/livewire/articles/_form.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class="flex items-center pl-3 font-sans text-base font-medium text-gray-500 dark
1717
</div>
1818
<div class="mt-3 flex items-center space-x-2 sm:mt-0">
1919
@hasanyrole('admin|moderator')
20-
<x-button type="button" wire:click="store">
20+
<x-buttons.primary type="button" wire:click="store">
2121
<x-loader class="text-white" wire:loading wire:target="store" />
2222
{{ isset($article) ? __('Enregistrer') : __('Publier') }}
23-
</x-button>
23+
</x-buttons.primary>
2424
@else
2525
@if (isset($article))
2626
<span class="relative z-20 inline-flex rounded-md shadow-sm">
@@ -98,10 +98,10 @@ class="block px-4 py-2 text-sm text-gray-700 dark:text-gray-300 hover:text-gray-
9898
</span>
9999
</span>
100100
@else
101-
<x-button type="button" wire:click="submit">
101+
<x-buttons.default type="button" wire:click="submit">
102102
<x-loader class="text-white" wire:loading wire:target="submit" />
103103
{{ __('Enregistrer') }}
104-
</x-button>
104+
</x-buttons.default>
105105
@endif
106106
@endhasanyrole
107107

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
<div>
2-
@include('livewire.articles._form')
2+
<div>
3+
@include('livewire.articles._form')
4+
</div>
35
</div>

resources/views/livewire/discussions/_form.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ class="mt-2"
3838

3939
<div class="border-t border-skin-base pt-5">
4040
<div class="flex justify-end">
41-
<x-button type="button" class="inline-flex" wire:click="store">
41+
<x-buttons.primary type="button" class="inline-flex" wire:click="store">
4242
<x-loader class="text-white" wire:loading wire:target="store" />
4343
Enregistrer
44-
</x-button>
44+
</x-buttons.primary>
4545
</div>
4646
</div>
4747
</div>
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
<div>
2-
@include('livewire.discussions._form')
2+
<div>
3+
<div>
4+
@include('livewire.discussions._form')
5+
</div>
6+
</div>
37
</div>

resources/views/livewire/forum/_form.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ class="font-medium text-primary-600 underline hover:text-primary-600-hover"
4949

5050
<div class="border-t border-skin-base pt-5">
5151
<div class="flex justify-end">
52-
<x-button type="button" class="inline-flex" wire:click="store">
52+
<x-buttons.primary type="button" class="inline-flex" wire:click="store">
5353
<x-loader class="text-white" wire:loading wire:target="store" />
5454
Enregistrer
55-
</x-button>
55+
</x-buttons.primary>
5656
</div>
5757
</div>
5858
</div>

0 commit comments

Comments
 (0)