Skip to content

Commit

Permalink
Typed functions and arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
parijke committed Dec 11, 2023
1 parent 0e9e349 commit 8f5bbf1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,64 +26,55 @@ interface AuthenticatedSessionStateHandler
/**
* Sets the moment at which the user was authenticated
*
* @return void
* @throws LogicException when an authentication moment was already logged
*/
public function logAuthenticationMoment();
public function logAuthenticationMoment(): void;

/**
* @return bool
*/
public function isAuthenticationMomentLogged();
public function isAuthenticationMomentLogged(): bool;

/**
* Gets the moment at which the user was authenticated
*
* @return DateTime
* @throws LogicException when no authentication moment was logged
*/
public function getAuthenticationMoment();
public function getAuthenticationMoment(): DateTime;

/**
* Updates the last interaction moment to the current moment
*
* @return void
*/
public function updateLastInteractionMoment();
public function updateLastInteractionMoment(): void;

/**
* Retrieves the last interaction moment
*
* @return DateTime
*/
public function getLastInteractionMoment();
public function getLastInteractionMoment(): DateTime;

/**
* @return bool
*/
public function hasSeenInteraction();
public function hasSeenInteraction(): bool;

/**
* @param string $uri
*/
public function setCurrentRequestUri($uri);
public function setCurrentRequestUri(string $uri): void;

/**
* @return string
*/
public function getCurrentRequestUri();
public function getCurrentRequestUri(): string;

/**
* Migrates the current session to a new session id while maintaining all
* session attributes.
*/
public function migrate();
public function migrate(): void;

/**
* Invalidates the session
*
* Clears all session attributes and flashes and regenerates the
* session and deletes the old session from persistence
*/
public function invalidate();
public function invalidate(): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ public function getLastInteractionMoment(): DateTime
return DateTime::fromString($this->requestStack->getSession()->get(self::AUTH_SESSION_KEY . 'last_interaction'));
}

public function setCurrentRequestUri($uri): void
public function setCurrentRequestUri(string $uri): void
{
$this->requestStack->getSession()->set(self::AUTH_SESSION_KEY . 'current_uri', $uri);
}

public function getCurrentRequestUri()
public function getCurrentRequestUri(): string
{
$uri = $this->requestStack->getSession()->get(self::AUTH_SESSION_KEY . 'current_uri');
$this->requestStack->getSession()->remove(self::AUTH_SESSION_KEY . 'current_uri');
Expand Down

0 comments on commit 8f5bbf1

Please sign in to comment.