Skip to content

Commit e4a72ca

Browse files
cybersoldattechmckenziearts
authored andcommitted
Fix code styling
1 parent 191f3f3 commit e4a72ca

File tree

5 files changed

+6
-14
lines changed

5 files changed

+6
-14
lines changed

app/Actions/Article/CreateArticleAction.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
<?php
22

3-
43
declare(strict_types=1);
54

65
namespace App\Actions\Article;
76

8-
use Carbon\Carbon;
9-
use DateTimeInterface;
107
use App\Data\Article\CreateArticleData;
118
use App\Gamify\Points\ArticleCreated;
129
use App\Models\Article;
1310
use App\Notifications\PostArticleToTelegram;
11+
use Carbon\Carbon;
12+
use DateTimeInterface;
1413
use Illuminate\Support\Facades\Auth;
1514

1615
final class CreateArticleAction
1716
{
1817
public function execute(CreateArticleData $articleData): Article
1918
{
20-
if ($articleData->published_at && !($articleData->published_at instanceof DateTimeInterface)) {
19+
if ($articleData->published_at && ! ($articleData->published_at instanceof DateTimeInterface)) {
2120
$articleData->published_at = new Carbon(
2221
time: $articleData->published_at,
2322
tz: config('app.timezone')
@@ -55,7 +54,6 @@ public function execute(CreateArticleData $articleData): Article
5554
givePoint(new ArticleCreated($article));
5655
}
5756

58-
5957
return $article;
6058
}
6159
}

app/Data/Article/CreateArticleData.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public function __construct(
1414
public string $slug,
1515
public string $body,
1616
public Carbon $published_at,
17-
public Carbon | null $submitted_at,
18-
public Carbon | null $approved_at,
17+
public ?Carbon $submitted_at,
18+
public ?Carbon $approved_at,
1919
public string $show_toc,
2020
public string $canonical_url,
2121
public array $associateTags = [],

app/Livewire/Articles/Create.php

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use App\Models\User;
1111
use App\Traits\WithArticleAttributes;
1212
use App\Traits\WithTagsAssociation;
13-
1413
use Illuminate\Contracts\View\View;
1514
use Illuminate\Support\Facades\Auth;
1615
use Livewire\Component;
@@ -62,7 +61,6 @@ public function store(): void
6261
'user_id' => $user->id,
6362
]));
6463

65-
6664
$user->hasRole('user') ?
6765
$this->redirectRoute('dashboard') :
6866
$this->redirectRoute('articles.show', $article);

tests/Feature/Actions/Article/createArticleActionTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
<?php
22

3-
43
declare(strict_types=1);
54

65
use App\Actions\Article\CreateArticleAction;
76
use App\Data\Article\CreateArticleData;
87
use App\Models\Article;
98
use App\Models\Tag;
109

11-
1210
beforeEach(function (): void {
1311
$this->user = $this->login();
1412
$this->tagOne = Tag::factory()->create(['name' => 'Tag 1', 'concerns' => ['article']]);
1513
$this->tagTwo = Tag::factory()->create(['name' => 'Tag 2', 'concerns' => ['article', 'post']]);
1614
});
1715

18-
1916
describe(CreateArticleAction::class, function (): void {
2017
it('return the created article', function (): void {
2118
$articleDataWithoutTag = CreateArticleData::from([

tests/Feature/Article/SendTelegramNotificationTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
$this->user = $this->login();
1313
});
1414

15-
test('Send notification on telegram after submition on article', function () {
15+
test('Send notification on telegram after submition on article', function (): void {
1616

1717
// 2- soumission d'article par le user connecté
1818
$article = Livewire::actingAs($this->user)->test(Create::class)
@@ -38,7 +38,6 @@
3838
);
3939
}
4040

41-
4241
Notification::assertCount(1);
4342

4443
});

0 commit comments

Comments
 (0)