Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make sure token getId returns an int for tests
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Jun 26, 2023
commit f7a61ac18f3c38c6bb43f747f61189f8ada99f0d
2 changes: 1 addition & 1 deletion lib/private/Authentication/Token/IToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface IToken extends JsonSerializable {
/**
* Get the token ID
*/
public function getId(): ?int;
public function getId(): int;

/**
* Get the user UID
Expand Down
8 changes: 6 additions & 2 deletions lib/private/Authentication/Token/PublicKeyToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ public function __construct() {
$this->addType('passwordInvalid', 'bool');
}

public function getId(): ?int {
return $this->id;
public function getId(): int {
if ($this->id !== null) {
return $this->id;
} else {
throw new \InvalidArgumentException('Cannot call getId on an token which was not inserted yet');
}
}

public function getUID(): string {
Expand Down