Skip to content

Commit

Permalink
Handle new Psalm errors
Browse files Browse the repository at this point in the history
  • Loading branch information
scheb committed Dec 10, 2022
1 parent b09c3a3 commit a31696e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/bundle/Security/Http/Utils/JsonRequestUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static function isJsonRequest(Request $request): bool
*/
public static function getJsonPayloadValue(Request $request, string $parameterName): string|int|float|bool|null
{
/** @psalm-suppress RedundantCastGivenDocblockType */
$data = json_decode((string) $request->getContent());
if (!$data instanceof stdClass) {
throw new BadRequestException('Invalid JSON.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function createTotpForUser(TwoFactorInterface $user): TOTPInterface
throw new TwoFactorProviderLogicException('Cannot initialize TOTP, no secret code provided.');
}

/** @psalm-suppress ArgumentTypeCoercion */
$totp = TOTP::create($secret, 30, 'sha1', $this->digits);

$userAndHost = $user->getGoogleAuthenticatorUsername().($this->server ? '@'.$this->server : '');
Expand Down
1 change: 1 addition & 0 deletions src/totp/Security/TwoFactor/Provider/Totp/TotpFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function createTotpForUser(TwoFactorInterface $user): TOTPInterface
throw new TwoFactorProviderLogicException('Cannot initialize TOTP, no secret code provided.');
}

/** @psalm-suppress ArgumentTypeCoercion */
$totp = TOTP::create(
$secret,
$totpConfiguration->getPeriod(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/
class TrustedCookieResponseListener implements EventSubscriberInterface
{
/**
* @param Cookie::SAMESITE_*|null $cookieSameSite
*/
public function __construct(
private TrustedDeviceTokenStorage $trustedTokenStorage,
private int $trustedTokenLifetime,
Expand Down

0 comments on commit a31696e

Please sign in to comment.