Skip to content

Commit 4390a03

Browse files
authored
fix: handle auth where user not found #56
1 parent d32ce36 commit 4390a03

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Subscribers/AuthenticationLoggingSubscriber.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ public function subscribe(Dispatcher $events): array
3030
];
3131
}
3232

33-
protected function shouldLogAuthentication(Authenticatable $user): bool
33+
protected function shouldLogAuthentication(?Authenticatable $user): bool
3434
{
35-
return in_array(LogsAuthentication::class, class_uses_recursive(get_class($user)));
35+
return !is_null($user) && in_array(LogsAuthentication::class, class_uses_recursive(get_class($user)));
3636
}
3737

38-
protected function logEvent(Authenticatable $user, bool $wasSuccessful, array $overrides = [])
38+
protected function logEvent(?Authenticatable $user, bool $wasSuccessful, array $overrides = [])
3939
{
4040
if (! $this->shouldLogAuthentication($user)) {
4141
return;

0 commit comments

Comments
 (0)