Skip to content

Commit e804a52

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 da97931 + cf0b1f4 commit e804a52

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Tests/Loader/PhpFileLoaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public function testImportAttributesWithPsr4Prefix(string $configFile)
336336
new LoaderResolver([
337337
$loader = new PhpFileLoader($locator),
338338
new Psr4DirectoryLoader($locator),
339-
new class() extends AttributeClassLoader {
339+
new class extends AttributeClassLoader {
340340
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot): void
341341
{
342342
$route->setDefault('_controller', $class->getName().'::'.$method->getName());
@@ -361,7 +361,7 @@ public function testImportAttributesFromClass()
361361
{
362362
new LoaderResolver([
363363
$loader = new PhpFileLoader(new FileLocator(\dirname(__DIR__).'/Fixtures')),
364-
new class() extends AttributeClassLoader {
364+
new class extends AttributeClassLoader {
365365
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot): void
366366
{
367367
$route->setDefault('_controller', $class->getName().'::'.$method->getName());

Tests/Loader/Psr4DirectoryLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private function getLoader(): DelegatingLoader
105105
return new DelegatingLoader(
106106
new LoaderResolver([
107107
new Psr4DirectoryLoader($locator),
108-
new class() extends AttributeClassLoader {
108+
new class extends AttributeClassLoader {
109109
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot): void
110110
{
111111
$route->setDefault('_controller', $class->getName().'::'.$method->getName());

Tests/Loader/XmlFileLoaderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ public function testImportAttributesWithPsr4Prefix(string $configFile)
616616
new LoaderResolver([
617617
$loader = new XmlFileLoader($locator),
618618
new Psr4DirectoryLoader($locator),
619-
new class() extends AttributeClassLoader {
619+
new class extends AttributeClassLoader {
620620
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot): void
621621
{
622622
$route->setDefault('_controller', $class->getName().'::'.$method->getName());
@@ -641,7 +641,7 @@ public function testImportAttributesFromClass()
641641
{
642642
new LoaderResolver([
643643
$loader = new XmlFileLoader(new FileLocator(\dirname(__DIR__).'/Fixtures')),
644-
new class() extends AttributeClassLoader {
644+
new class extends AttributeClassLoader {
645645
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot): void
646646
{
647647
$route->setDefault('_controller', $class->getName().'::'.$method->getName());

Tests/Loader/YamlFileLoaderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ public function testPriorityWithPrefix()
474474
{
475475
new LoaderResolver([
476476
$loader = new YamlFileLoader(new FileLocator(\dirname(__DIR__).'/Fixtures/localized')),
477-
new class() extends AttributeClassLoader {
477+
new class extends AttributeClassLoader {
478478
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot): void
479479
{
480480
$route->setDefault('_controller', $class->getName().'::'.$method->getName());
@@ -498,7 +498,7 @@ public function testImportAttributesWithPsr4Prefix(string $configFile)
498498
new LoaderResolver([
499499
$loader = new YamlFileLoader($locator),
500500
new Psr4DirectoryLoader($locator),
501-
new class() extends AttributeClassLoader {
501+
new class extends AttributeClassLoader {
502502
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot): void
503503
{
504504
$route->setDefault('_controller', $class->getName().'::'.$method->getName());
@@ -523,7 +523,7 @@ public function testImportAttributesFromClass()
523523
{
524524
new LoaderResolver([
525525
$loader = new YamlFileLoader(new FileLocator(\dirname(__DIR__).'/Fixtures')),
526-
new class() extends AttributeClassLoader {
526+
new class extends AttributeClassLoader {
527527
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot): void
528528
{
529529
$route->setDefault('_controller', $class->getName().'::'.$method->getName());

0 commit comments

Comments
 (0)