Skip to content

Commit

Permalink
refactor: fix phpstan errors in the providers & CommentObserver
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiorodriguesroque committed Nov 10, 2024
1 parent 32d7207 commit d7e899d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/Observers/CommentObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function created(Comment $comment): void
$user->notify(new ItemHasNewCommentNotification($comment, $user));
});

$comment->parent?->user->notify(new CommentHasReplyNotification($comment));
$comment->parent?->user?->notify(new CommentHasReplyNotification($comment));
}

public function deleting(Comment $comment): void
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function boot(Kernel $kernel): void
View::composer('partials.meta', static function ($view) {
$view->with(
'defaultImage',
OgImageGenerator::make(config('app.name'))
OgImageGenerator::make(config()->string('app.name'))
->withSubject('Roadmap')
->withPolygonDecoration()
->withFilename('og.jpg')
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/Filament/AdminPanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function panel(Panel $panel): Panel
->colors([
'primary' => Color::Blue,
])
->spa(config('filament.spa'))
->spa(config()->boolean('filament.spa'))
->viteTheme('resources/css/admin.css')
->favicon(file_exists($favIcon = storage_path('app/public/favicon.png')) ? asset('storage/favicon.png') . '?v=' . md5_file($favIcon) : null)
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
Expand Down
4 changes: 2 additions & 2 deletions app/Providers/HelperServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class HelperServiceProvider extends ServiceProvider
*
* @return void
*/
public function register()
public function register(): void
{
foreach (glob(app_path('Helpers') . '/*.php') as $file) {
foreach (glob(app_path('Helpers') . '/*.php') ?: [] as $file) {
require_once $file;
}
}
Expand Down
9 changes: 7 additions & 2 deletions app/Rules/ProfanityCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@

class ProfanityCheck implements Rule
{
public function passes($attribute, $value)
/**
* @param $attribute
* @param string $value
* @return bool
*/
public function passes($attribute, $value): bool
{
$words = explode(' ', $value);

Expand All @@ -20,7 +25,7 @@ public function passes($attribute, $value)
return true;
}

public function message()
public function message(): string
{
return 'The content here contains profanity words, please correct these.';
}
Expand Down

0 comments on commit d7e899d

Please sign in to comment.