Skip to content

Commit b7e0258

Browse files
committed
minor symfony#57919 Fix multiple CS errors (alexandre-daubois)
This PR was merged into the 7.2 branch. Discussion ---------- Fix multiple CS errors | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT My first intention was to add a missing backslash to calls to `sprintf` as `@derrabus` did a few months ago, before thinking that perhaps a CS Fixer pass might be beneficial. Here are some notable improvements thanks to this pass: - The addition of backslashes for `sprintf`, even more important since the improvements to the PHP engine - Addition of trailing commas in array declarations, but especially when using CPP, as recently "standardized" in a recent PR - Reordering (or better, removal) of a few (sometimes uesless) `use` statements - Some `array_key_exists` were missing a leading backslash, preventing the engine to use the opcode dedicated to it - Added leading backslash to a few calls PHP CS Fixer assumed beneficial Commits ------- 390d834 Fix multiple CS errors
2 parents c841825 + 390d834 commit b7e0258

File tree

42 files changed

+50
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+50
-62
lines changed

src/Symfony/Bridge/Doctrine/Tests/ArgumentResolver/EntityValueResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function testResolveWithArrayIdNullValue()
148148
$request = new Request();
149149
$request->attributes->set('nullValue', null);
150150

151-
$argument = $this->createArgument(entity: new MapEntity(id: ['nullValue']), isNullable: true,);
151+
$argument = $this->createArgument(entity: new MapEntity(id: ['nullValue']), isNullable: true);
152152

153153
$this->assertSame([null], $resolver->resolve($request, $argument));
154154
}

src/Symfony/Bridge/PhpUnit/ClockMock.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static function microtime($asFloat = false)
7272
return self::$now;
7373
}
7474

75-
return sprintf('%0.6f00 %d', self::$now - (int) self::$now, (int) self::$now);
75+
return \sprintf('%0.6f00 %d', self::$now - (int) self::$now, (int) self::$now);
7676
}
7777

7878
public static function date($format, $timestamp = null): string
@@ -101,7 +101,7 @@ public static function hrtime($asNumber = false)
101101
$ns = (self::$now - (int) self::$now) * 1000000000;
102102

103103
if ($asNumber) {
104-
$number = sprintf('%d%d', (int) self::$now, $ns);
104+
$number = \sprintf('%d%d', (int) self::$now, $ns);
105105

106106
return \PHP_INT_SIZE === 8 ? (int) $number : (float) $number;
107107
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9595
$io->note($this->localVault->getLastMessage());
9696
}
9797

98-
if ($hadErrors) {
98+
if ($hadErrors) {
9999
return 1;
100100
}
101101

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Composer\InstalledVersions;
1515
use Http\Client\HttpAsyncClient;
1616
use Http\Client\HttpClient;
17-
use Symfony\Component\TypeInfo\TypeResolver\PhpDocAwareReflectionTypeResolver;
1817
use phpDocumentor\Reflection\DocBlockFactoryInterface;
1918
use phpDocumentor\Reflection\Types\ContextFactory;
2019
use PhpParser\Parser;
@@ -173,6 +172,7 @@
173172
use Symfony\Component\Translation\PseudoLocalizationTranslator;
174173
use Symfony\Component\Translation\Translator;
175174
use Symfony\Component\TypeInfo\Type;
175+
use Symfony\Component\TypeInfo\TypeResolver\PhpDocAwareReflectionTypeResolver;
176176
use Symfony\Component\TypeInfo\TypeResolver\StringTypeResolver;
177177
use Symfony\Component\Uid\Factory\UuidFactory;
178178
use Symfony\Component\Uid\UuidV4;

src/Symfony/Bundle/FrameworkBundle/Resources/config/services.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []
155155

156156
->set('uri_signer', UriSigner::class)
157157
->args([
158-
new Parameter('kernel.secret')
158+
new Parameter('kernel.secret'),
159159
])
160160
->alias(UriSigner::class, 'uri_signer')
161161

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Doctrine\DBAL\Connection;
1515
use PHPUnit\Framework\TestCase;
16-
use Seld\JsonLint\JsonParser;
1716
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Configuration;
1817
use Symfony\Bundle\FullStack;
1918
use Symfony\Component\Cache\Adapter\DoctrineAdapter;

src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function collect(Request $request, Response $response, ?\Throwable $excep
210210

211211
$this->data['deauth_profile_token'] = null;
212212
$response->headers->clearCookie($deauthCookieName);
213-
} elseif(!$this->data['authenticated'] && !$this->data['deauth_profile_token']) {
213+
} elseif (!$this->data['authenticated'] && !$this->data['deauth_profile_token']) {
214214
$response->headers->setCookie(new Cookie($deauthCookieName, $profileToken));
215215

216216
$this->data['auth_profile_token'] = null;

src/Symfony/Component/AssetMapper/Tests/Factory/MappedAssetFactoryTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Symfony\Component\AssetMapper\Compiler\CssAssetUrlCompiler;
2020
use Symfony\Component\AssetMapper\Compiler\JavaScriptImportPathCompiler;
2121
use Symfony\Component\AssetMapper\Exception\CircularAssetsException;
22-
use Symfony\Component\AssetMapper\Exception\InvalidArgumentException;
2322
use Symfony\Component\AssetMapper\Factory\MappedAssetFactory;
2423
use Symfony\Component\AssetMapper\ImportMap\ImportMapConfigReader;
2524
use Symfony\Component\AssetMapper\MappedAsset;

src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public function warmUp(array $values): array
321321

322322
$dump .= "\n], [\n\n{$dumpedValues}\n]];\n";
323323

324-
$tmpFile = tempnam(dirname($this->file), basename($this->file));
324+
$tmpFile = tempnam(\dirname($this->file), basename($this->file));
325325

326326
file_put_contents($tmpFile, $dump);
327327
@chmod($tmpFile, 0666 & ~umask());

src/Symfony/Component/Cache/Tests/Traits/RedisTraitTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ public static function provideInvalidDbIndexDsnParameter(): array
200200
{
201201
return [
202202
[
203-
'redis://:p%40ssword@'.getenv('REDIS_AUTHENTICATED_HOST').'/abc'
203+
'redis://:p%40ssword@'.getenv('REDIS_AUTHENTICATED_HOST').'/abc',
204204
],
205205
[
206-
'redis://:p%40ssword@'.getenv('REDIS_AUTHENTICATED_HOST').'/3?dbindex=6'
207-
]
206+
'redis://:p%40ssword@'.getenv('REDIS_AUTHENTICATED_HOST').'/3?dbindex=6',
207+
],
208208
];
209209
}
210210
}

0 commit comments

Comments
 (0)