Skip to content

Commit dde4a2e

Browse files
minor symfony#59467 chore: PHP CS Fixer fixes (keradus)
This PR was squashed before being merged into the 7.3 branch. Discussion ---------- chore: PHP CS Fixer fixes | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | Fix CS <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Commits ------- 0cd4c52 chore: PHP CS Fixer fixes
2 parents 8f6560c + 0cd4c52 commit dde4a2e

File tree

23 files changed

+48
-40
lines changed

23 files changed

+48
-40
lines changed

src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public function loadTokenBySeries(string $series): PersistentTokenInterface
5757
$row = $stmt->fetchNumeric() ?: throw new TokenNotFoundException('No token found.');
5858

5959
[$class, $username, $value, $last_used] = $row;
60+
6061
return new PersistentToken($class, $username, $series, $value, new \DateTimeImmutable($last_used));
6162
}
6263

src/Symfony/Bundle/FrameworkBundle/Command/TranslationExtractCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __construct(
6262
parent::__construct();
6363

6464
if (!method_exists($writer, 'getFormats')) {
65-
throw new \InvalidArgumentException(sprintf('The writer class "%s" does not implement the "getFormats()" method.', $writer::class));
65+
throw new \InvalidArgumentException(\sprintf('The writer class "%s" does not implement the "getFormats()" method.', $writer::class));
6666
}
6767
}
6868

src/Symfony/Component/DependencyInjection/Tests/Argument/LazyClosureTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\DependencyInjection\Tests\Argument;
1313

14-
use InvalidArgumentException;
1514
use PHPUnit\Framework\TestCase;
1615
use Symfony\Component\DependencyInjection\Argument\LazyClosure;
1716
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -23,7 +22,7 @@ public function testMagicGetThrows()
2322
{
2423
$closure = new LazyClosure(fn () => null);
2524

26-
$this->expectException(InvalidArgumentException::class);
25+
$this->expectException(\InvalidArgumentException::class);
2726
$this->expectExceptionMessage('Cannot read property "foo" from a lazy closure.');
2827

2928
$closure->foo;
@@ -34,7 +33,7 @@ public function testThrowsWhenNotUsingInterface()
3433
$this->expectException(\RuntimeException::class);
3534
$this->expectExceptionMessage('Cannot create adapter for service "foo" because "Symfony\Component\DependencyInjection\Tests\Argument\LazyClosureTest" is not an interface.');
3635

37-
LazyClosure::getCode('foo', [new \stdClass(), 'bar'], new Definition(LazyClosureTest::class), new ContainerBuilder(), 'foo');
36+
LazyClosure::getCode('foo', [new \stdClass(), 'bar'], new Definition(self::class), new ContainerBuilder(), 'foo');
3837
}
3938

4039
public function testThrowsOnNonFunctionalInterface()

src/Symfony/Component/HttpClient/Tests/NoPrivateNetworkHttpClientTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,14 @@ public function testNonCallableOnProgressCallback()
178178
public function testHeadersArePassedOnRedirect()
179179
{
180180
$ipAddr = '104.26.14.6';
181-
$url = sprintf('http://%s/', $ipAddr);
181+
$url = \sprintf('http://%s/', $ipAddr);
182182
$content = 'foo';
183183

184184
$callback = function ($method, $url, $options) use ($content): MockResponse {
185185
$this->assertArrayHasKey('headers', $options);
186186
$this->assertNotContains('content-type: application/json', $options['headers']);
187187
$this->assertContains('foo: bar', $options['headers']);
188+
188189
return new MockResponse($content);
189190
};
190191
$responses = [

src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/RequestPayloadValueResolverTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ public function testQueryStringParameterTypeMismatch()
420420

421421
try {
422422
$resolver->onKernelControllerArguments($event);
423-
$this->fail(sprintf('Expected "%s" to be thrown.', HttpException::class));
423+
$this->fail(\sprintf('Expected "%s" to be thrown.', HttpException::class));
424424
} catch (HttpException $e) {
425425
$validationFailedException = $e->getPrevious();
426426
$this->assertInstanceOf(ValidationFailedException::class, $validationFailedException);
@@ -514,7 +514,7 @@ public function testRequestInputTypeMismatch()
514514

515515
try {
516516
$resolver->onKernelControllerArguments($event);
517-
$this->fail(sprintf('Expected "%s" to be thrown.', HttpException::class));
517+
$this->fail(\sprintf('Expected "%s" to be thrown.', HttpException::class));
518518
} catch (HttpException $e) {
519519
$validationFailedException = $e->getPrevious();
520520
$this->assertInstanceOf(ValidationFailedException::class, $validationFailedException);

src/Symfony/Component/Ldap/LdapInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ public function bind(?string $dn = null, #[\SensitiveParameter] ?string $passwor
3838
*
3939
* @throws ConnectionException if dn / password could not be bound
4040
*/
41-
// public function saslBind(?string $dn = null, #[\SensitiveParameter] ?string $password = null, ?string $mech = null, ?string $realm = null, ?string $authcId = null, ?string $authzId = null, ?string $props = null): void;
41+
// public function saslBind(?string $dn = null, #[\SensitiveParameter] ?string $password = null, ?string $mech = null, ?string $realm = null, ?string $authcId = null, ?string $authzId = null, ?string $props = null): void;
4242

4343
/**
4444
* Returns authenticated and authorized (for SASL) DN.
4545
*/
46-
// public function whoami(): string;
46+
// public function whoami(): string;
4747

4848
/**
4949
* Queries a ldap server for entries matching the given criteria.

src/Symfony/Component/Mailer/Bridge/AhaSend/Transport/AhaSendApiTransport.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
7777
}
7878
}
7979
}
80+
8081
return $response;
8182
}
8283

@@ -101,7 +102,6 @@ private function getPayload(Email $email, Envelope $envelope): array
101102
],
102103
];
103104

104-
105105
$text = $email->getTextBody();
106106
if (!empty($text)) {
107107
$payload['content']['text_body'] = $text;
@@ -149,7 +149,7 @@ private function prepareHeaders(Headers $headers): array
149149
$headersPrepared[$header->getName()] = $header->getBodyAsString();
150150
}
151151
if (!empty($tags)) {
152-
$tagsStr = implode(",", $tags);
152+
$tagsStr = implode(',', $tags);
153153
$headers->addTextHeader('AhaSend-Tags', $tagsStr);
154154
$headersPrepared['AhaSend-Tags'] = $tagsStr;
155155
}
@@ -180,7 +180,6 @@ private function getAttachments(Email $email): array
180180
'base64' => $base64,
181181
];
182182

183-
184183
if ($attachment->hasContentId()) {
185184
$att['content_id'] = $attachment->getContentId();
186185
} elseif ('inline' === $disposition) {

src/Symfony/Component/Mailer/Bridge/AhaSend/Transport/AhaSendSmtpTransport.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
use Psr\EventDispatcher\EventDispatcherInterface;
1515
use Psr\Log\LoggerInterface;
1616
use Symfony\Component\Mailer\Envelope;
17-
use Symfony\Component\Mailer\Exception\TransportException;
18-
use Symfony\Component\Mailer\Header\MetadataHeader;
1917
use Symfony\Component\Mailer\Header\TagHeader;
2018
use Symfony\Component\Mailer\SentMessage;
2119
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
@@ -55,7 +53,7 @@ private function addAhaSendHeaders(Message $message): void
5553
}
5654
}
5755
if (!empty($tags)) {
58-
$headers->addTextHeader('AhaSend-Tags', implode(",", $tags));
56+
$headers->addTextHeader('AhaSend-Tags', implode(',', $tags));
5957
}
6058
}
6159
}

src/Symfony/Component/Mailer/Bridge/AhaSend/Webhook/AhaSendRequestParser.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function doParse(Request $request, #[\SensitiveParameter] string $secr
4646
if (empty($eventID) || empty($signature) || empty($timestamp)) {
4747
throw new RejectWebhookException(406, 'Signature is required.');
4848
}
49-
if (!is_numeric($timestamp) || is_float($timestamp+0) || (int)$timestamp != $timestamp || (int)$timestamp <= 0) {
49+
if (!is_numeric($timestamp) || \is_float($timestamp + 0) || (int) $timestamp != $timestamp || (int) $timestamp <= 0) {
5050
throw new RejectWebhookException(406, 'Invalid timestamp.');
5151
}
5252
$expectedSignature = $this->sign($eventID, $timestamp, $request->getContent(), $secret);
@@ -64,11 +64,12 @@ protected function doParse(Request $request, #[\SensitiveParameter] string $secr
6464
}
6565
}
6666

67-
private function sign(string $eventID, string $timestamp, string $payload, $secret) : string
67+
private function sign(string $eventID, string $timestamp, string $payload, $secret): string
6868
{
6969
$signaturePayload = "{$eventID}.{$timestamp}.{$payload}";
7070
$hash = hash_hmac('sha256', $signaturePayload, $secret);
7171
$signature = base64_encode(pack('H*', $hash));
72+
7273
return "v1,{$signature}";
7374
}
7475
}

src/Symfony/Component/Mailer/Bridge/Postal/Tests/Transport/PostalApiTransportTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function getTransportData(): array
3535
{
3636
return [
3737
[
38-
(new PostalApiTransport('TOKEN', 'postal.localhost')),
38+
new PostalApiTransport('TOKEN', 'postal.localhost'),
3939
'postal+api://postal.localhost',
4040
],
4141
[

0 commit comments

Comments
 (0)