Skip to content

Commit 2b75964

Browse files
authored
Merge pull request #196 from kenjis/fix-logout-return-type
refactor: change logout() return type to void
2 parents f0c09b4 + 28c9f5e commit 2b75964

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/Authentication/AuthenticatorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function loginById($userId): void;
5050
*
5151
* @see https://codeigniter4.github.io/CodeIgniter4/extending/authentication.html
5252
*/
53-
public function logout(): bool;
53+
public function logout(): void;
5454

5555
/**
5656
* Returns the currently logged in user.

src/Authentication/Authenticators/AccessTokens.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,9 @@ public function loginById($userId): void
189189
/**
190190
* Logs the current user out.
191191
*/
192-
public function logout(): bool
192+
public function logout(): void
193193
{
194194
$this->user = null;
195-
196-
return true;
197195
}
198196

199197
/**

src/Authentication/Authenticators/Session.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -660,10 +660,10 @@ public function loginById($userId): void
660660
/**
661661
* Logs the current user out.
662662
*/
663-
public function logout(): bool
663+
public function logout(): void
664664
{
665665
if ($this->user === null) {
666-
return true;
666+
return;
667667
}
668668

669669
helper('cookie');
@@ -686,11 +686,9 @@ public function logout(): bool
686686
$this->rememberModel->purgeRememberTokens($this->user);
687687

688688
// Trigger logout event
689-
$result = Events::trigger('logout', $this->user);
689+
Events::trigger('logout', $this->user);
690690

691691
$this->user = null;
692-
693-
return $result;
694692
}
695693

696694
/**

0 commit comments

Comments
 (0)