Skip to content

Commit 78c80ab

Browse files
committed
minor #57901 Code style change in `@PER-CS2.0 affecting @Symfony` (parentheses for anonymous classes) (bonroyage)
This PR was squashed before being merged into the 7.2 branch. Discussion ---------- Code style change in ``@PER`-CS2.0` affecting ``@Symfony`` (parentheses for anonymous classes) | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT I have created a PR (PHP-CS-Fixer/PHP-CS-Fixer#8140) in the PHP-CS-Fixer repo to bring the ``@PER`-CS2.0` ruleset in line with the specifications on the `new_with_parentheses` rule for anonymous classes. Since the ``@Symfony`` ruleset builds upon the ``@PER`-CS2.0` ruleset, they would like confirmation that the Symfony community is OK with this change affecting the Symfony ruleset as well. Should it not be, I'll push another commit there ensuring that the change does not affect ``@Symfony``. Therefore, this PR is not meant to be merged, but function as an RFC to get your opinion and show the effect it would have when applied to the Symfony source. Commits ------- 506e0dd327 Code style change in ``@PER`-CS2.0` affecting ``@Symfony`` (parentheses for anonymous classes)
2 parents 5b2ddbb + 13dabdf commit 78c80ab

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Tests/CacheWarmer/ConfigBuilderCacheWarmerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public function testExtensionAddedInKernel()
189189
$kernel = new class($this->varDir) extends TestKernel {
190190
protected function build(ContainerBuilder $container): void
191191
{
192-
$container->registerExtension(new class() extends Extension implements ConfigurationInterface {
192+
$container->registerExtension(new class extends Extension implements ConfigurationInterface {
193193
public function load(array $configs, ContainerBuilder $container): void
194194
{
195195
}
@@ -276,7 +276,7 @@ protected function build(ContainerBuilder $container): void
276276
{
277277
/** @var TestSecurityExtension $extension */
278278
$extension = $container->getExtension('test_security');
279-
$extension->addAuthenticatorFactory(new class() implements TestAuthenticatorFactoryInterface {
279+
$extension->addAuthenticatorFactory(new class implements TestAuthenticatorFactoryInterface {
280280
public function getKey(): string
281281
{
282282
return 'token';
@@ -292,19 +292,19 @@ public function registerBundles(): iterable
292292
{
293293
yield from parent::registerBundles();
294294

295-
yield new class() extends Bundle {
295+
yield new class extends Bundle {
296296
public function getContainerExtension(): ExtensionInterface
297297
{
298298
return new TestSecurityExtension();
299299
}
300300
};
301301

302-
yield new class() extends Bundle {
302+
yield new class extends Bundle {
303303
public function build(ContainerBuilder $container): void
304304
{
305305
/** @var TestSecurityExtension $extension */
306306
$extension = $container->getExtension('test_security');
307-
$extension->addAuthenticatorFactory(new class() implements TestAuthenticatorFactoryInterface {
307+
$extension->addAuthenticatorFactory(new class implements TestAuthenticatorFactoryInterface {
308308
public function getKey(): string
309309
{
310310
return 'form-login';

Tests/DependencyInjection/Compiler/ProfilerPassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function testValidCollector()
6666

6767
public static function provideValidCollectorWithTemplateUsingAutoconfigure(): \Generator
6868
{
69-
yield [new class() implements TemplateAwareDataCollectorInterface {
69+
yield [new class implements TemplateAwareDataCollectorInterface {
7070
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
7171
{
7272
}
@@ -86,7 +86,7 @@ public static function getTemplate(): string
8686
}
8787
}];
8888

89-
yield [new class() extends AbstractDataCollector {
89+
yield [new class extends AbstractDataCollector {
9090
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
9191
{
9292
}

Tests/Test/WebTestCaseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ private function getRequestTester(): WebTestCase
388388

389389
private function getTester(KernelBrowser $client): WebTestCase
390390
{
391-
$tester = new class() extends WebTestCase {
391+
$tester = new class extends WebTestCase {
392392
use WebTestAssertionsTrait {
393393
getClient as public;
394394
}

0 commit comments

Comments
 (0)