Skip to content

[HttpFoundation] Add phpstan-pure to UriSigner to avoid unhandled checks #54297

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

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 7 additions & 0 deletions src/Symfony/Component/HttpFoundation/UriSigner.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public function __construct(#[\SensitiveParameter] string $secret, string $param
*
* The given URI is signed by adding the query string parameter
* which value depends on the URI and the secret.
*
* @phpstan-pure
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we use psalm in our CI (even though we use it in an incremental mode), we generally use the psalm- prefix rather than the phpstan- one.

*/
public function sign(string $uri): string
{
Expand All @@ -55,6 +57,8 @@ public function sign(string $uri): string

/**
* Checks that a URI contains the correct hash.
*
* @phpstan-pure
*/
public function check(string $uri): bool
{
Expand All @@ -75,6 +79,9 @@ public function check(string $uri): bool
return hash_equals($this->computeHash($this->buildUrl($url, $params)), $hash);
}

/**
* @phpstan-pure
*/
public function checkRequest(Request $request): bool
{
$qs = ($qs = $request->server->get('QUERY_STRING')) ? '?'.$qs : '';
Expand Down