Skip to content

Commit

Permalink
fix: remove null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
solracsf committed Jan 24, 2025
1 parent 0130bac commit b138d77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
* @return JSONResponse
*/
public function state(): JSONResponse {
$user = $this->userSession?->getUser();
$user = $this->userSession->getUser();
if (is_null($user)) {
throw new \Exception('user not available');
}
Expand All @@ -53,7 +53,7 @@ public function state(): JSONResponse {
* @param string|null $code for verification
*/
public function enable(int $state, ?string $code = null): JSONResponse {
$user = $this->userSession?->getUser();
$user = $this->userSession->getUser();
if (is_null($user)) {
throw new \Exception('user not available');
}
Expand Down Expand Up @@ -94,7 +94,7 @@ public function enable(int $state, ?string $code = null): JSONResponse {
*/
private function getSecretName(): string {
$productName = $this->defaults->getName();
$user = $this->userSession?->getUser();
$user = $this->userSession->getUser();
if ($user === null) {
throw new RuntimeException('No user in this context');
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Listener/UserDeleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public function __construct(
public function handle(Event $event): void {
if ($event instanceof UserDeletedEvent) {
try {
$this->totpSecretMapper->deleteSecretByUserId($event->getUser()?->getUID());
$this->totpSecretMapper->deleteSecretByUserId($event->getUser()->getUID());
} catch (Exception $e) {
$this->logger->warning($e->getMessage(), ['uid' => $event->getUser()?->getUID()]);
$this->logger->warning($e->getMessage(), ['uid' => $event->getUser()->getUID()]);
}
}
}
Expand Down

0 comments on commit b138d77

Please sign in to comment.