Skip to content

Commit 2b0994e

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 6b86ebe + f28c925 commit 2b0994e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Tests/Service/ServiceMethodsSubscriberTraitTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testParentNotCalledIfHasMagicCall()
4646
$container = new class([]) implements ContainerInterface {
4747
use ServiceLocatorTrait;
4848
};
49-
$service = new class() extends ParentWithMagicCall {
49+
$service = new class extends ParentWithMagicCall {
5050
use ServiceMethodsSubscriberTrait;
5151
};
5252

@@ -59,7 +59,7 @@ public function testParentNotCalledIfNoParent()
5959
$container = new class([]) implements ContainerInterface {
6060
use ServiceLocatorTrait;
6161
};
62-
$service = new class() {
62+
$service = new class {
6363
use ServiceMethodsSubscriberTrait;
6464
};
6565

Tests/Service/ServiceSubscriberTraitTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function testParentNotCalledIfHasMagicCall()
5454
$container = new class([]) implements ContainerInterface {
5555
use ServiceLocatorTrait;
5656
};
57-
$service = new class() extends ParentWithMagicCall {
57+
$service = new class extends ParentWithMagicCall {
5858
use ServiceSubscriberTrait;
5959
};
6060

@@ -67,7 +67,7 @@ public function testParentNotCalledIfNoParent()
6767
$container = new class([]) implements ContainerInterface {
6868
use ServiceLocatorTrait;
6969
};
70-
$service = new class() {
70+
$service = new class {
7171
use ServiceSubscriberTrait;
7272
};
7373

@@ -82,7 +82,7 @@ public function testSetContainerCalledFirstOnParent()
8282
};
8383
$container2 = clone $container1;
8484

85-
$testService = new class() extends LegacyParentTestService2 implements ServiceSubscriberInterface {
85+
$testService = new class extends LegacyParentTestService2 implements ServiceSubscriberInterface {
8686
use ServiceSubscriberTrait;
8787
};
8888
$this->assertNull($testService->setContainer($container1));

Translation/Test/TranslatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function tearDown(): void
4545

4646
public function getTranslator(): TranslatorInterface
4747
{
48-
return new class() implements TranslatorInterface {
48+
return new class implements TranslatorInterface {
4949
use TranslatorTrait;
5050
};
5151
}
@@ -366,7 +366,7 @@ protected function validateMatrix(string $nplural, array $matrix, bool $expectSu
366366

367367
protected function generateTestData($langCodes)
368368
{
369-
$translator = new class() {
369+
$translator = new class {
370370
use TranslatorTrait {
371371
getPluralizationRule as public;
372372
}

0 commit comments

Comments
 (0)