Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Csrf] Added type-hint for CsrfTokenMangerInterface #32208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions src/Symfony/Component/Security/Csrf/CsrfTokenManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function __construct(TokenGeneratorInterface $generator = null, TokenStor
/**
* {@inheritdoc}
*/
public function getToken($tokenId)
public function getToken(string $tokenId)
{
$namespacedId = $this->getNamespace().$tokenId;
if ($this->storage->hasToken($namespacedId)) {
Expand All @@ -83,7 +83,7 @@ public function getToken($tokenId)
/**
* {@inheritdoc}
*/
public function refreshToken($tokenId)
public function refreshToken(string $tokenId)
{
$namespacedId = $this->getNamespace().$tokenId;
$value = $this->generator->generateToken();
Expand All @@ -96,7 +96,7 @@ public function refreshToken($tokenId)
/**
* {@inheritdoc}
*/
public function removeToken($tokenId)
public function removeToken(string $tokenId)
{
return $this->storage->removeToken($this->getNamespace().$tokenId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface CsrfTokenManagerInterface
*
* @return CsrfToken The CSRF token
*/
public function getToken($tokenId);
public function getToken(string $tokenId);

/**
* Generates a new token value for the given ID.
Expand All @@ -44,7 +44,7 @@ public function getToken($tokenId);
*
* @return CsrfToken The CSRF token
*/
public function refreshToken($tokenId);
public function refreshToken(string $tokenId);

/**
* Invalidates the CSRF token with the given ID, if one exists.
Expand All @@ -54,7 +54,7 @@ public function refreshToken($tokenId);
* @return string|null Returns the removed token value if one existed, NULL
* otherwise
*/
public function removeToken($tokenId);
public function removeToken(string $tokenId);

/**
* Returns whether the given CSRF token is valid.
Expand Down