Skip to content

Commit a88ba79

Browse files
authored
minor #191 [ci] php-cs-fixer it up
1 parent 244a53c commit a88ba79

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

src/Model/VerifyEmailSignatureComponents.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function getExpirationMessageData(): array
122122
public function getExpiresAtIntervalInstance(): \DateInterval
123123
{
124124
if (null === $this->generatedAt) {
125-
throw new \LogicException(sprintf('%s initialized without setting the $generatedAt timestamp.', self::class));
125+
throw new \LogicException(\sprintf('%s initialized without setting the $generatedAt timestamp.', self::class));
126126
}
127127

128128
$createdAtTime = \DateTimeImmutable::createFromFormat('U', (string) $this->generatedAt);

src/VerifyEmailHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function validateEmailConfirmationFromRequest(Request $request, string $u
9494
{
9595
/** @legacy - Remove in 2.0 */
9696
if (!$this->uriSigner instanceof UriSigner) {
97-
throw new \RuntimeException(sprintf('An instance of %s is required, provided by symfony/http-kernel >=6.4, to validate an email confirmation.', UriSigner::class));
97+
throw new \RuntimeException(\sprintf('An instance of %s is required, provided by symfony/http-kernel >=6.4, to validate an email confirmation.', UriSigner::class));
9898
}
9999

100100
if (!$this->uriSigner->checkRequest($request)) {

tests/AcceptanceTests/VerifyEmailAcceptanceTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testGenerateSignature(): void
4949

5050
$expectedSignature = base64_encode(hash_hmac(
5151
'sha256',
52-
sprintf('http://localhost/verify/user?expires=%s&token=%s', $expiresAt, urlencode($expectedToken)),
52+
\sprintf('http://localhost/verify/user?expires=%s&token=%s', $expiresAt, urlencode($expectedToken)),
5353
'foo',
5454
true
5555
));
@@ -59,7 +59,7 @@ public function testGenerateSignature(): void
5959

6060
self::assertTrue(hash_equals($expectedSignature, $result['signature']));
6161
self::assertSame(
62-
sprintf('http://localhost/verify/user?expires=%s&signature=%s&token=%s', $expiresAt, urlencode($expectedSignature), urlencode($expectedToken)),
62+
\sprintf('http://localhost/verify/user?expires=%s&signature=%s&token=%s', $expiresAt, urlencode($expectedSignature), urlencode($expectedToken)),
6363
$signature
6464
);
6565
}
@@ -75,7 +75,7 @@ public function testValidateEmailSignature(): void
7575
$helper = $container->get(VerifyEmailAcceptanceFixture::class)->helper;
7676
$expires = new \DateTimeImmutable('+1 hour');
7777

78-
$uriToTest = sprintf(
78+
$uriToTest = \sprintf(
7979
'/verify/user?%s',
8080
http_build_query([
8181
'expires' => $expires->getTimestamp(),
@@ -90,7 +90,7 @@ public function testValidateEmailSignature(): void
9090

9191
$signature = base64_encode(hash_hmac('sha256', $uriToTest, 'foo', true));
9292

93-
$test = sprintf('%s&signature=%s', $uriToTest, urlencode($signature));
93+
$test = \sprintf('%s&signature=%s', $uriToTest, urlencode($signature));
9494

9595
$helper->validateEmailConfirmation($test, '1234', 'jr@rushlow.dev');
9696
$this->assertTrue(true, 'Test correctly does not throw an exception');
@@ -107,7 +107,7 @@ public function testValidateUsingRequestObject(): void
107107
$helper = $container->get(VerifyEmailAcceptanceFixture::class)->helper;
108108
$expires = new \DateTimeImmutable('+1 hour');
109109

110-
$uriToTest = sprintf(
110+
$uriToTest = \sprintf(
111111
'http://localhost/verify/user?%s',
112112
http_build_query([
113113
'expires' => $expires->getTimestamp(),
@@ -122,7 +122,7 @@ public function testValidateUsingRequestObject(): void
122122

123123
$signature = base64_encode(hash_hmac('sha256', $uriToTest, 'foo', true));
124124

125-
$test = sprintf('%s&signature=%s', $uriToTest, urlencode($signature));
125+
$test = \sprintf('%s&signature=%s', $uriToTest, urlencode($signature));
126126

127127
$helper->validateEmailConfirmationFromRequest(Request::create(uri: $test), '1234', 'jr@rushlow.dev');
128128
$this->assertTrue(true, 'Test correctly does not throw an exception');

tests/FunctionalTests/VerifyEmailHelperFunctionalTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testGenerateSignature(): void
5252
->expects($this->once())
5353
->method('generate')
5454
->with('app_verify_route', ['expires' => $this->expiryTimestamp, 'token' => $token])
55-
->willReturn(sprintf('/verify?expires=%s&token=%s', $this->expiryTimestamp, urlencode($token)))
55+
->willReturn(\sprintf('/verify?expires=%s&token=%s', $this->expiryTimestamp, urlencode($token)))
5656
;
5757

5858
$result = $this->getHelper()->generateSignature('app_verify_route', '1234', 'jr@rushlow.dev');
@@ -91,7 +91,7 @@ private function getTestToken(): string
9191
private function getTestSignature(): string
9292
{
9393
$query = http_build_query(['expires' => $this->expiryTimestamp, 'token' => $this->getTestToken()], '', '&');
94-
$uri = sprintf('/verify?%s', $query);
94+
$uri = \sprintf('/verify?%s', $query);
9595

9696
return base64_encode(hash_hmac('sha256', $uri, 'foo', true));
9797
}
@@ -100,7 +100,7 @@ private function getTestSignedUri(): string
100100
{
101101
$token = urlencode($this->getTestToken());
102102

103-
$uri = sprintf('/verify?expires=%s&token=%s', $this->expiryTimestamp, $token);
103+
$uri = \sprintf('/verify?expires=%s&token=%s', $this->expiryTimestamp, $token);
104104
$signature = base64_encode(hash_hmac('sha256', $uri, 'foo', true));
105105

106106
$uriComponents = parse_url($uri);
@@ -111,7 +111,7 @@ private function getTestSignedUri(): string
111111

112112
$sortedParams = http_build_query($params);
113113

114-
return sprintf('/verify?%s', $sortedParams);
114+
return \sprintf('/verify?%s', $sortedParams);
115115
}
116116

117117
private function getHelper(): VerifyEmailHelperInterface

tests/UnitTests/Model/VerifyEmailSignatureComponentsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testTranslations(int $lifetime, int $expectedInterval, string $u
4040
$components = new VerifyEmailSignatureComponents($expire, 'some-uri', $created);
4141

4242
self::assertSame(
43-
sprintf('%%count%% %s|%%count%% %ss', $unitOfMeasure, $unitOfMeasure),
43+
\sprintf('%%count%% %s|%%count%% %ss', $unitOfMeasure, $unitOfMeasure),
4444
$components->getExpirationMessageKey()
4545
);
4646

tests/UnitTests/VerifyEmailHelperTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function testSignatureIsGenerated(): void
5959
{
6060
$expires = time() + 3600;
6161

62-
$expectedSignedUrl = sprintf('/verify?expires=%s&signature=1234&token=hashedToken', $expires);
62+
$expectedSignedUrl = \sprintf('/verify?expires=%s&signature=1234&token=hashedToken', $expires);
6363

6464
$this->tokenGenerator
6565
->expects($this->once())
@@ -72,13 +72,13 @@ public function testSignatureIsGenerated(): void
7272
->expects($this->once())
7373
->method('generate')
7474
->with('app_verify_route', ['token' => 'hashedToken', 'expires' => $expires])
75-
->willReturn(sprintf('/verify?expires=%s&token=hashedToken', $expires))
75+
->willReturn(\sprintf('/verify?expires=%s&token=hashedToken', $expires))
7676
;
7777

7878
$this->mockSigner
7979
->expects($this->once())
8080
->method('sign')
81-
->with(sprintf('/verify?expires=%s&token=hashedToken', $expires))
81+
->with(\sprintf('/verify?expires=%s&token=hashedToken', $expires))
8282
->willReturn($expectedSignedUrl)
8383
;
8484

0 commit comments

Comments
 (0)