8000 chore: PHP CS Fixer fixes · symfonyaml/symfony@0cd4c52 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0cd4c52

Browse files
keradusnicolas-grekas
authored andcommitted
chore: PHP CS Fixer fixes
1 parent c98cfb6 commit 0cd4c52

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
[

src/Symfony/Component/Mailer/Bridge/Sendgrid/Tests/RemoteEvent/SendgridPayloadConverterTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Symfony\Component\Mailer\Bridge\Sendgrid\Tests\RemoteEvent;
413

514
use PHPUnit\Framework\TestCase;

src/Symfony/Component/Messenger/Bridge/Beanstalkd/Transport/BeanstalkdReceiver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
use Symfony\Component\Messenger\Envelope;
1515
use Symfony\Component\Messenger\Exception\LogicException;
1616
use Symfony\Component\Messenger\Exception\MessageDecodingFailedException;
17+
use Symfony\Component\Messenger\Stamp\TransportMessageIdStamp;
1718
use Symfony\Component\Messenger\Transport\Receiver\KeepaliveReceiverInterface;
1819
use Symfony\Component\Messenger\Transport\Receiver\MessageCountAwareInterface;
1920
use Symfony\Component\Messenger\Transport\Serialization\PhpSerializer;
2021
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
21-
use Symfony\Component\Messenger\Stamp\TransportMessageIdStamp;
2222

2323
/**
2424
* @author Antonio Pauletich <antonio.pauletich95@gmail.com>

src/Symfony/Component/Messenger/Bridge/Redis/Transport/RedisReceiver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
use Symfony\Component\Messenger\Exception\LogicException;
1616
use Symfony\Component\Messenger\Exception\MessageDecodingFailedException;
1717
use Symfony\Component\Messenger\Exception\TransportException;
18+
use Symfony\Component\Messenger\Stamp\TransportMessageIdStamp;
1819
use Symfony\Component\Messenger\Transport\Receiver\KeepaliveReceiverInterface;
1920
use Symfony\Component\Messenger\Transport\Receiver\MessageCountAwareInterface;
2021
use Symfony\Component\Messenger\Transport\Serialization\PhpSerializer;
2122
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
22-
use Symfony\Component\Messenger\Stamp\TransportMessageIdStamp;
2323

2424
/**
2525
* @author Alexander Schranz <alexander@sulu.io>

src/Symfony/Component/Notifier/Bridge/Telegram/TelegramTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected function doSend(MessageInterface $message): SentMessage
9494
* - __underlined text__
9595
* - various notations of images, f. ex. [title](url)
9696
* - `code samples`.
97-
*
97+
*
9898
* These formats should be taken care of when the message is constructed.
9999
*
100100
* @see https://core.telegram.org/bots/api#markdownv2-style

src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ class PropertyAccessor implements PropertyAccessorInterface
7272
* Should not be used by application code. Use
7373
* {@link PropertyAccess::createPropertyAccessor()} instead.
7474
*
75-
* @param int $magicMethods A bitwise combination of the MAGIC_* constants
76-
* to specify the allowed magic methods (__get, __set, __call)
77-
* or self::DISALLOW_MAGIC_METHODS for none
78-
* @param int $throw A bitwise combination of the THROW_* constants
79-
* to specify when exceptions should be thrown
75+
* @param int $magicMethodsFlags A bitwise combination of the MAGIC_* constants
76+
* to specify the allowed magic methods (__get, __set, __call)
77+
* or self::DISALLOW_MAGIC_METHODS for none
78+
* @param int $throw A bitwise combination of the THROW_* constants
79+
* to specify when exceptions should be thrown
8080
*/
8181
public function __construct(
8282
private int $magicMethodsFlags = self::MAGIC_GET | self::MAGIC_SET,
@@ -216,7 +216,7 @@ public function isReadable(object|array $objectOrArray, string|PropertyPathInter
216216
];
217217

218218
// handle stdClass with properties with a dot in the name
219-
if ($objectOrArray instanceof \stdClass && str_contains($propertyPath, '.') && property_exists($objectOrArray, $propertyPath)) {
219+
if ($objectOrArray instanceof \stdClass && str_contains($propertyPath, '.') && property_exists BD94 ($objectOrArray, $propertyPath)) {
220220
$this->readProperty($zval, $propertyPath, $this->ignoreInvalidProperty);
221221
} else {
222222
$this->readPropertiesUntil($zval, $propertyPath, $propertyPath->getLength(), $this->ignoreInvalidIndices);
@@ -635,7 +635,7 @@ private function isPropertyWritable(object $object, string $property): bool
635635

636636
$mutatorForArray = $this->getWriteInfo($object::class, $property, []);
637637
if (PropertyWriteInfo::TYPE_PROPERTY === $mutatorForArray->getType()) {
638-
return $mutatorForArray->getVisibility() === 'public';
638+
return 'public' === $mutatorForArray->getVisibility();
639639
}
640640

641641
if (PropertyWriteInfo::TYPE_NONE !== $mutatorForArray->getType()) {

src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ public function testSetValueWithAsymmetricVisibility(string $propertyPath, ?stri
10951095
}
10961096

10971097
/**
1098-
* @return iterable<array{0: string, 1: null|class-string}>
1098+
* @return iterable<array{0: string, 1: class-string|null}>
10991099
*/
11001100
public static function setValueWithAsymmetricVisibilityDataProvider(): iterable
11011101
{

src/Symfony/Component/PropertyInfo/PropertyDocBlockExtractorInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ interface PropertyDocBlockExtractorInterface
2626
/**
2727
* Gets the first available doc block for a property. It finds the doc block
2828
* by the following priority:
29-
* - constructor promoted argument
30-
* - the class property
31-
* - a mutator method for that property
29+
* - constructor promoted argument,
30+
* - the class property,
31+
* - a mutator method for that property.
3232
*
3333
* If no doc block is found, it will return null.
3434
*/

src/Symfony/Component/PropertyInfo/Tests/Extractor/SerializerExtractorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ public function testGetPropertiesWithAnyGroup()
5252

5353
public function testGetPropertiesWithNonExistentClassReturnsNull()
5454
{
55-
$this->assertSame(null, $this->extractor->getProperties('NonExistent'));
55+
$this->assertNull($this->extractor->getProperties('NonExistent'));
5656
}
5757
}

src/Symfony/Component/Security/Core/User/ChainUserChecker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function checkPreAuth(UserInterface $user): void
2929
}
3030
}
3131

32-
public function checkPostAuth(UserInterface $user /*, TokenInterface $token*/): void
32+
public function checkPostAuth(UserInterface $user /* , TokenInterface $token */): void
3333
{
3434
$token = 1 < \func_num_args() ? func_get_arg(1) : null;
3535

src/Symfony/Component/Security/Core/User/UserCheckerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ public function checkPreAuth(UserInterface $user): void;
3535
*
3636
* @throws AccountStatusException
3737
*/
38-
public function checkPostAuth(UserInterface $user /*, TokenInterface $token*/): void;
38+
public function checkPostAuth(UserInterface $user /* , TokenInterface $token */): void;
3939
}

src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,7 @@ class TruePropertyDummy
15871587

15881588
class BoolPropertyDummy
15891589
{
1590-
/** @var null|bool */
1590+
/** @var bool|null */
15911591
public $foo;
15921592
}
15931593

src/Symfony/Component/Translation/Dumper/PoFileDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private function getStandardRules(string $id): array
100100
if (preg_match($intervalRegexp, $part)) {
101101
// Explicit rule is not a standard rule.
102102
return [];
103-
}
103+
}
104104

105105
$standardRules[] = $part;
106106
}

src/Symfony/Component/Yaml/Tests/ParserTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,14 +1771,14 @@ public static function wrappedUnquotedStringsProvider()
17711771
[
17721772
'foo' => 'bar bar',
17731773
'fiz' => 'cat cat',
1774-
]
1774+
],
17751775
],
17761776
'sequence' => [
17771777
'[ bar bar, cat cat ]',
17781778
[
17791779
'bar bar',
17801780
'cat cat',
1781-
]
1781+
],
17821782
],
17831783
];
17841784
}
@@ -2218,7 +2218,7 @@ public static function inlineNotationSpanningMultipleLinesProvider(): array
22182218
<<<YAML
22192219
map: {key: "value", a: "b"} # comment
22202220
param: "some"
2221-
YAML
2221+
YAML,
22222222
],
22232223
'mixed mapping with compact inline notation on one line' => [
22242224
[

0 commit comments

Comments
 (0)
0