Skip to content

Commit 0c8cc1b

Browse files
committed
refactoring: Drop laravel world dependencies and apply refactoring to views and tests
1 parent 611d8a4 commit 0c8cc1b

File tree

118 files changed

+2097
-1941
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+2097
-1941
lines changed

.github/workflows/phpstan.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
php: [8.2]
14-
laravel: [9.*]
13+
php: [8.2, 8.3]
14+
laravel: [10.*]
1515
dependency-version: [prefer-stable]
16-
include:
17-
- laravel: 9.*
1816
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
1917
steps:
2018
- uses: actions/checkout@v3
@@ -32,4 +30,4 @@ jobs:
3230
- name: Install dependencies
3331
run: composer install --prefer-dist --no-interaction
3432
- name: Run PHPStan
35-
run: composer stan
33+
run: ./vendor/bin/phpstan

.phpunit.cache/test-results

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":"pest_2.35.0","defects":[],"times":{"P\\Tests\\Feature\\BasicArchitectureTest::__pest_evaluable__Debug_test__\u2192_there_is_not_any_dd_or_dump_left":0.387,"P\\Tests\\Feature\\Cleanup\\DeleteOldUnverifiedUsersTest::__pest_evaluable_it_will_delete_unverified_users_after_some_days":0.066,"P\\Tests\\Feature\\Cleanup\\DeleteOldUnverifiedUsersTest::__pest_evaluable_it_will_not_delete_verified_users":0.002,"P\\Tests\\Feature\\Forum\\ChannelTest::__pest_evaluable_channel_can_have_children":0.006,"P\\Tests\\Feature\\Forum\\ChannelTest::__pest_evaluable_child_channel_can_be_a_parent":0.004,"P\\Tests\\Feature\\Forum\\DiscussionTest::__pest_evaluable_it_can_find_by_slug":0.003,"P\\Tests\\Feature\\Forum\\DiscussionTest::__pest_evaluable_it_can_give_an_excerpt_of_its_body":0.005,"P\\Tests\\Feature\\Forum\\DiscussionTest::__pest_evaluable_html_in_excerpts_is_markdown_converted":0.003,"P\\Tests\\Feature\\Forum\\DiscussionTest::__pest_evaluable_it_can_have_many_tags":0.004,"P\\Tests\\Feature\\Forum\\DiscussionTest::__pest_evaluable_it_records_activity_when_a_discussion_is_created":0.007,"P\\Tests\\Feature\\Forum\\DiscussionTest::__pest_evaluable_it_generates_a_slug_when_valid_url_characters_provided":0.001,"P\\Tests\\Feature\\Forum\\DiscussionTest::__pest_evaluable_it_generates_a_unique_slug_when_valid_url_characters_provided":0.002,"P\\Tests\\Feature\\Forum\\DiscussionTest::__pest_evaluable_it_generates_a_slug_when_invalid_url_characters_provided":0.022,"P\\Tests\\Feature\\Forum\\ReplyTest::__pest_evaluable_it_records_activity_when_a_reply_is_send":0,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_it_can_find_by_slug":0.002,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_it_can_give_an_excerpt_of_its_body":0.002,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_html_in_excerpts_is_markdown_converted":0.002,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_it_can_have_many_channels":0,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_it_records_activity_when_a_thread_is_created":0,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_its_conversation_is_old_when_the_oldest_reply_was_six_months_ago":0.005,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_its_conversation_is_old_when_there_are_no_replies_but_the_creation_date_was_six_months_ago":0.002,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_we_can_mark_and_unmark_a_reply_as_the_solution":0.007,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_it_can_retrieve_the_latest_threads_in_a_correct_order":0.004,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_it_can_retrieve_only_resolved_threads":0.007,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_it_can_retrieve_only_active_threads":0.005,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_it_generates_a_slug_when_valid_url_characters_provided":0.001,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_it_generates_a_unique_slug_when_valid_url_characters_provided":0.003,"P\\Tests\\Feature\\Forum\\ThreadTest::__pest_evaluable_it_generates_a_slug_when_invalid_url_characters_provided":0.001,"P\\Tests\\Feature\\UserActivitiesTest::__pest_evaluable_it_records_activity_when_an_article_is_created":0,"P\\Tests\\Feature\\UserActivitiesTest::__pest_evaluable_it_get_feed_from_any_user":0}}

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<p align="center">
66
<a href="https://laravel.com">
7-
<img alt="Laravel v9.x" src="https://img.shields.io/badge/Laravel-v9.x-FF2D20">
7+
<img alt="Laravel v10.x" src="https://img.shields.io/badge/Laravel-v10.x-FF2D20">
88
</a>
99
<a href="https://github.com/laravelcm/laravel.cm/actions">
1010
<img src="https://github.com/laravelcm/laravel.cm/workflows/Tests/badge.svg" alt="Build Status" />
@@ -29,10 +29,9 @@ Vous pouvez rejoindre la communauté ou nous suivre via nos différentes platefo
2929
## Sponsors
3030
Nous tenons à remercier ces **entreprises extraordinaires** pour leur parrainage. Si vous souhaitez devenir sponsor, veuillez visiter <a href="https://laravel.cm/sponsors">la page Laravel.cm de Sponsoring</a>.
3131

32-
- **[Laravel Shopper](https://laravelshopper.io)**
32+
- **[Laravel Shopper](https://laravelshopper.dev)**
3333
- [GDG Douala](https://gdg.community.dev/gdg-douala)
3434
- [NotchPay](https://notchpay.co)
35-
- [Dark Code](https://dark-code.cm)
3635
- [Sharuco](https://sharuco.lndev.me)
3736

3837
## Caractéristiques Serveur
@@ -90,11 +89,11 @@ TELEGRAM_CHANNEL=
9089
```
9190

9291
## Commands
93-
Command | Description
94-
--- | ---
95-
**`composer pest`** | Exécuter les tests
96-
`php artisan migrate:fresh --seed` | Reset la base de données
97-
`yarn run watch` | Surveillez les changements dans les fichiers CSS et JS
92+
| Command | Description |
93+
|------------------------------------|--------------------------------------------------------|
94+
| **`composer test`** | Exécuter les tests |
95+
| `php artisan migrate:fresh --seed` | Reset la base de données |
96+
| `yarn && yarn watch` | Surveillez les changements dans les fichiers CSS et JS |
9897

9998
## Maintainers
10099

app/Console/Commands/CreateAdminUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
namespace App\Console\Commands;
66

77
use App\Models\User;
8+
use Exception;
89
use Illuminate\Console\Command;
910
use Illuminate\Database\QueryException;
1011
use Illuminate\Support\Facades\Hash;
11-
use Exception;
1212

1313
final class CreateAdminUser extends Command
1414
{

app/Events/ApiRegistered.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ final class ApiRegistered
1111
{
1212
use SerializesModels;
1313

14-
public function __construct(public User $user)
15-
{
16-
}
14+
public function __construct(public User $user) {}
1715
}

app/Events/ArticleWasSubmittedForApproval.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ final class ArticleWasSubmittedForApproval
1111
{
1212
use SerializesModels;
1313

14-
public function __construct(public Article $article)
15-
{
16-
}
14+
public function __construct(public Article $article) {}
1715
}

app/Events/CommentWasAdded.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,5 @@
1212
{
1313
use SerializesModels;
1414

15-
public function __construct(public Reply $reply, public Discussion $discussion)
16-
{
17-
}
15+
public function __construct(public Reply $reply, public Discussion $discussion) {}
1816
}

app/Events/EmailAddressWasChanged.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ final class EmailAddressWasChanged
1313
use Dispatchable;
1414
use SerializesModels;
1515

16-
public function __construct(public User $user)
17-
{
18-
}
16+
public function __construct(public User $user) {}
1917
}

app/Events/ReplyWasCreated.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ final class ReplyWasCreated
1111
{
1212
use SerializesModels;
1313

14-
public function __construct(public Reply $reply)
15-
{
16-
}
14+
public function __construct(public Reply $reply) {}
1715
}

app/Events/SponsoringPaymentInitialize.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ final class SponsoringPaymentInitialize
1111
{
1212
use SerializesModels;
1313

14-
public function __construct(public Transaction $transaction)
15-
{
16-
}
14+
public function __construct(public Transaction $transaction) {}
1715
}

app/Events/ThreadWasCreated.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ final class ThreadWasCreated
1111
{
1212
use SerializesModels;
1313

14-
public function __construct(public Thread $thread)
15-
{
16-
}
14+
public function __construct(public Thread $thread) {}
1715
}

app/Filters/AbstractFilters.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ abstract class AbstractFilters
1313

1414
protected array $filters = [];
1515

16-
public function __construct(public Request $request)
17-
{
18-
}
16+
public function __construct(public Request $request) {}
1917

2018
public function filter(Builder $builder): Builder
2119
{

app/Filters/Thread/SortByFilter.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public function mappings(): array
2121

2222
/**
2323
* @param Builder<Thread> $builder
24-
* @param mixed $value
2524
* @return Builder<Thread>
2625
*/
2726
public function filter(Builder $builder, mixed $value): Builder

app/Http/Controllers/Api/Auth/ForgotPasswordController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __invoke(ForgotPasswordRequest $request): JsonResponse
1717
$request->only('email')
1818
);
1919

20-
return Password::RESET_LINK_SENT === $status
20+
return $status === Password::RESET_LINK_SENT
2121
? response()->json(['message' => __('L\'e-mail de réinitialisation du mot de passe a été envoyé avec succès !')])
2222
: response()->json(['error' => __('Un courriel ne pourrait être envoyé à cette adresse électronique !')], 401);
2323
}

app/Http/Controllers/Api/Auth/RegisterController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function googleAuthenticator(Request $request): JsonResponse
6363

6464
if ($user->hasRole('user')) {
6565
return response()->json([
66-
'error' => __('Vous n\'êtes pas autorisé à accéder à cette section avec cette adresse e-mail.')
66+
'error' => __('Vous n\'êtes pas autorisé à accéder à cette section avec cette adresse e-mail.'),
6767
], 401);
6868
}
6969

app/Http/Controllers/Api/Auth/ResetPasswordController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function (User $user) use ($request): void {
2929
}
3030
);
3131

32-
return Password::PASSWORD_RESET === $status
32+
return $status === Password::PASSWORD_RESET
3333
? response()->json(['message' => __('Votre mot de passe a été réinitialisé avec succès !')])
3434
: response()->json(['error' => __('Le jeton de réinitialisation du mot de passe est invalide !')], 401);
3535
}

app/Http/Controllers/OAuthController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
use Illuminate\Database\Eloquent\ModelNotFoundException;
1111
use Illuminate\Http\RedirectResponse;
1212
use Illuminate\Support\Facades\Auth;
13-
use Laravel\Socialite\Two\InvalidStateException;
1413
use Laravel\Socialite\Contracts\User as SocialUser;
14+
use Laravel\Socialite\Two\InvalidStateException;
1515

1616
final class OAuthController extends Controller
1717
{
1818
use HasSocialite;
1919

20-
public function redirectToProvider(string $provider): RedirectResponse | \Symfony\Component\HttpFoundation\RedirectResponse
20+
public function redirectToProvider(string $provider): RedirectResponse|\Symfony\Component\HttpFoundation\RedirectResponse
2121
{
2222
if ( ! in_array($provider, $this->getAcceptedProviders(), true)) {
2323
return redirect()

app/Http/Controllers/SponsoringController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function sponsors(): View
2121
);
2222

2323
return view('sponsors.index', [
24-
'sponsors' => $sponsors
24+
'sponsors' => $sponsors,
2525
]);
2626
}
2727
}

app/Http/Controllers/User/ProfileController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
final class ProfileController extends Controller
1717
{
18-
public function show(Request $request, User $user = null): View | RedirectResponse
18+
public function show(Request $request, ?User $user = null): View|RedirectResponse
1919
{
2020
if ($user) {
2121
$articles = Article::with('tags')

app/Http/Middleware/HttpsProtocol.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
final class HttpsProtocol
1515
{
16-
public function handle(Request $request, Closure $next): RedirectResponse | Response | JsonResponse | BinaryFileResponse
16+
public function handle(Request $request, Closure $next): RedirectResponse|Response|JsonResponse|BinaryFileResponse
1717
{
1818
if (app()->environment('production') && ! $request->isSecure()) {
1919
return redirect()->secure($request->getRequestUri());

app/Http/Middleware/RedirectIfAuthenticated.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
final class RedirectIfAuthenticated
1515
{
16-
public function handle(Request $request, Closure $next, ...$guards): Response | RedirectResponse
16+
public function handle(Request $request, Closure $next, ...$guards): Response|RedirectResponse
1717
{
1818
$guards = empty($guards) ? [null] : $guards;
1919

app/Listeners/SendCompanyEmailVerificationNotification.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ final class SendCompanyEmailVerificationNotification implements ShouldQueue
1414

1515
/**
1616
* Handle the event.
17-
*
18-
* @param ApiRegistered $event
19-
* @return void
2017
*/
2118
public function handle(ApiRegistered $event): void
2219
{

app/Listeners/SendNewArticleNotification.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111
final readonly class SendNewArticleNotification
1212
{
13-
public function __construct(private AnonymousNotifiable $notifiable)
14-
{
15-
}
13+
public function __construct(private AnonymousNotifiable $notifiable) {}
1614

1715
public function handle(ArticleWasSubmittedForApproval $event): void
1816
{

app/Listeners/SendNewCommentNotification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function handle(CommentWasAdded $event): void
2222
// @phpstan-ignore-next-line
2323
$subscription->user->notify(new NewCommentNotification(
2424
reply: $event->reply,
25-
subscription: $subscription,
25+
subscription: $subscription,
2626
discussion: $discussion
2727
));
2828
}

app/Listeners/SendPaymentNotification.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111
final readonly class SendPaymentNotification
1212
{
13-
public function __construct(private AnonymousNotifiable $notifiable)
14-
{
15-
}
13+
public function __construct(private AnonymousNotifiable $notifiable) {}
1614

1715
public function handle(SponsoringPaymentInitialize $event): void
1816
{

app/Listeners/SendWelcomeCompanyNotification.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ final class SendWelcomeCompanyNotification implements ShouldQueue
1414

1515
/**
1616
* Handle the event.
17-
*
18-
* @param ApiRegistered $event
19-
* @return void
2017
*/
2118
public function handle(ApiRegistered $event): void
2219
{

app/Livewire/Articles/Edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function mount(Article $article): void
4848

4949
public function submit(): void
5050
{
51-
$this->alreadySubmitted = null !== $this->article->submitted_at;
51+
$this->alreadySubmitted = $this->article->submitted_at !== null;
5252
$this->submitted_at = $this->article->submitted_at ?? now();
5353
$this->store();
5454
}

app/Livewire/Modals/AnonymousSponsors.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function submit(): void
7676
'transaction_reference' => $payload->transaction->reference,
7777
'user_id' => $adminUser->id,
7878
'fees' => $payload->transaction->fee,
79-
'type' => 'one-time' === $this->option
79+
'type' => $this->option === 'one-time'
8080
? TransactionType::ONETIME->value
8181
: TransactionType::RECURSIVE->value,
8282
'metadata' => [
@@ -91,7 +91,7 @@ public function submit(): void
9191
'initiated_at' => $payload->transaction->initiated_at,
9292
'description' => $payload->transaction->description,
9393
'for' => PaymentType::SPONSORING->value,
94-
]
94+
],
9595
]);
9696

9797
$this->redirect($payload->authorization_url); // @phpstan-ignore-line

app/Livewire/SponsorSubscription.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function subscribe(): void
6060
'transaction_reference' => $payload->transaction->reference,
6161
'user_id' => Auth::id(),
6262
'fees' => $payload->transaction->fee,
63-
'type' => 'one-time' === $this->option
63+
'type' => $this->option === 'one-time'
6464
? TransactionType::ONETIME->value
6565
: TransactionType::RECURSIVE->value,
6666
'metadata' => [

app/Mail/NewReplyEmail.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ final class NewReplyEmail extends Mailable implements ShouldQueue
1717
public function __construct(
1818
public readonly Reply $reply,
1919
public readonly Subscribe $subscription
20-
) {
21-
}
20+
) {}
2221

2322
public function build(): self
2423
{

app/Mail/SendMailToUnVerifiedUsers.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ final class SendMailToUnVerifiedUsers extends Mailable implements ShouldQueue
1515
use Queueable;
1616
use SerializesModels;
1717

18-
public function __construct(public User $user)
19-
{
20-
}
18+
public function __construct(public User $user) {}
2119

2220
public function build(): self
2321
{

app/Mail/Welcome.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ final class Welcome extends Mailable implements ShouldQueue
1515
use Queueable;
1616
use SerializesModels;
1717

18-
public function __construct(public readonly User $user)
19-
{
20-
}
18+
public function __construct(public readonly User $user) {}
2119

2220
public function build(): self
2321
{

0 commit comments

Comments
 (0)