From 7434d8935fecb8bd00593942cc4e392118d59fb6 Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Wed, 3 Nov 2021 13:39:16 +0100 Subject: [PATCH 1/4] Update OskarStark/php-cs-fixer-ga to 3.2.1 --- .github/workflows/phpcs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 3259b5a409..539db64956 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -13,6 +13,6 @@ jobs: uses: actions/checkout@v2 - name: Check for code style violation with PHP-CS-Fixer - uses: OskarStark/php-cs-fixer-ga@3.0.0 + uses: OskarStark/php-cs-fixer-ga@3.2.1 with: args: --diff --dry-run From 434e2b39d6d4e2e5adabbe26a50129c2c0ce3370 Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Wed, 3 Nov 2021 13:41:31 +0100 Subject: [PATCH 2/4] Fix build --- tests/Carbon/InstanceTest.php | 4 ++-- tests/Carbon/LocalizationTest.php | 2 +- tests/CarbonImmutable/InstanceTest.php | 4 ++-- tests/CarbonImmutable/LocalizationTest.php | 2 +- tests/CarbonImmutable/SetStateTest.php | 2 +- tests/CarbonPeriod/CreateTest.php | 2 +- tests/CarbonTimeZone/ConversionsTest.php | 2 +- tests/PHPStan/MacroTest.php | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/Carbon/InstanceTest.php b/tests/Carbon/InstanceTest.php index 05666a7f8d..5ba5cab889 100644 --- a/tests/Carbon/InstanceTest.php +++ b/tests/Carbon/InstanceTest.php @@ -140,7 +140,7 @@ public function testInvalidCast() public function testChildCast() { - $class = \get_class(new class() extends Carbon { + $class = \get_class(new class () extends Carbon { public function foo() { return 42; @@ -158,7 +158,7 @@ public function foo() public function testSiblingCast() { - $class = \get_class(new class() extends DateTime { + $class = \get_class(new class () extends DateTime { public function foo() { return 42; diff --git a/tests/Carbon/LocalizationTest.php b/tests/Carbon/LocalizationTest.php index a475593ea6..1d5d859c9a 100644 --- a/tests/Carbon/LocalizationTest.php +++ b/tests/Carbon/LocalizationTest.php @@ -701,7 +701,7 @@ public function testNotLocaleAwareException() $this->markTestSkipped('In Symfony < 5, NotLocaleAwareException will never been thrown.'); } - $translator = new class() implements TranslatorInterface { + $translator = new class () implements TranslatorInterface { public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) { return 'x'; diff --git a/tests/CarbonImmutable/InstanceTest.php b/tests/CarbonImmutable/InstanceTest.php index 937f6bd117..ad4eac95ca 100644 --- a/tests/CarbonImmutable/InstanceTest.php +++ b/tests/CarbonImmutable/InstanceTest.php @@ -141,7 +141,7 @@ public function testInvalidCast() public function testChildCast() { - $class = \get_class(new class() extends Carbon { + $class = \get_class(new class () extends Carbon { public function foo() { return 42; @@ -159,7 +159,7 @@ public function foo() public function testSiblingCast() { - $class = \get_class(new class() extends DateTime { + $class = \get_class(new class () extends DateTime { public function foo() { return 42; diff --git a/tests/CarbonImmutable/LocalizationTest.php b/tests/CarbonImmutable/LocalizationTest.php index 0fe7bfecee..88b7bccb13 100644 --- a/tests/CarbonImmutable/LocalizationTest.php +++ b/tests/CarbonImmutable/LocalizationTest.php @@ -673,7 +673,7 @@ public function testNotLocaleAwareException() $this->markTestSkipped('In Symfony < 5, NotLocaleAwareException will never been thrown.'); } - $translator = new class() implements TranslatorInterface { + $translator = new class () implements TranslatorInterface { public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) { return 'x'; diff --git a/tests/CarbonImmutable/SetStateTest.php b/tests/CarbonImmutable/SetStateTest.php index 7343e4f7ec..058767fc26 100644 --- a/tests/CarbonImmutable/SetStateTest.php +++ b/tests/CarbonImmutable/SetStateTest.php @@ -21,7 +21,7 @@ class SetStateTest extends AbstractTestCase { public function testSteState() { - $obj = new class() { + $obj = new class () { use Serialization; public static function instance($value) diff --git a/tests/CarbonPeriod/CreateTest.php b/tests/CarbonPeriod/CreateTest.php index 47789c29a8..49037433e9 100644 --- a/tests/CarbonPeriod/CreateTest.php +++ b/tests/CarbonPeriod/CreateTest.php @@ -631,7 +631,7 @@ public function testInstance() public function testCast() { - $period = new class('2012-07-01', CarbonInterval::days(2), '2012-07-07') extends CarbonPeriod { + $period = new class ('2012-07-01', CarbonInterval::days(2), '2012-07-07') extends CarbonPeriod { public function foo() { return $this->getStartDate()->format('j').' '. diff --git a/tests/CarbonTimeZone/ConversionsTest.php b/tests/CarbonTimeZone/ConversionsTest.php index aa2a913a14..6b54a3db6f 100644 --- a/tests/CarbonTimeZone/ConversionsTest.php +++ b/tests/CarbonTimeZone/ConversionsTest.php @@ -126,7 +126,7 @@ public function testCast() $this->assertSame(DateTimeZone::class, \get_class($tz)); $this->assertSame('America/Toronto', $tz->getName()); - $obj = new class() extends CarbonTimeZone { + $obj = new class () extends CarbonTimeZone { }; $class = \get_class($obj); diff --git a/tests/PHPStan/MacroTest.php b/tests/PHPStan/MacroTest.php index 3f859c00fe..8fa33382d6 100644 --- a/tests/PHPStan/MacroTest.php +++ b/tests/PHPStan/MacroTest.php @@ -63,7 +63,7 @@ public function testIsPublic() public function testIsFinal() { - $mixinClass = new class() { + $mixinClass = new class () { // Declaring final won't apply for macro, sub-class will always be able to override macros. final public static function foo(): string { @@ -232,7 +232,7 @@ public function testGetPrototype() public function testGetReflection() { - $mixinClass = new class() { + $mixinClass = new class () { // Declaring final won't apply for macro, sub-class will always be able to override macros. final public static function foo(): string { From 089096f92ebaa72435a6d353af2c24a29fd61fa0 Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Mon, 8 Nov 2021 09:48:49 +0100 Subject: [PATCH 3/4] Set class_definition to false and please StyleCI (for now). --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 392d35e01d..21e6429e34 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -22,6 +22,7 @@ 'blank_line_after_namespace' => true, 'blank_line_before_statement' => true, 'cast_spaces' => true, + 'class_definition' => false, 'concat_space' => [ 'spacing' => 'none', ], From 0f4b8e26e5960cae023e1566f80c865ad4cd27f1 Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Mon, 8 Nov 2021 09:51:23 +0100 Subject: [PATCH 4/4] Fix StyleCI. --- tests/Carbon/InstanceTest.php | 4 ++-- tests/Carbon/LocalizationTest.php | 2 +- tests/CarbonImmutable/InstanceTest.php | 4 ++-- tests/CarbonImmutable/LocalizationTest.php | 2 +- tests/CarbonImmutable/SetStateTest.php | 2 +- tests/CarbonPeriod/CreateTest.php | 2 +- tests/CarbonTimeZone/ConversionsTest.php | 2 +- tests/PHPStan/MacroTest.php | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/Carbon/InstanceTest.php b/tests/Carbon/InstanceTest.php index 5ba5cab889..05666a7f8d 100644 --- a/tests/Carbon/InstanceTest.php +++ b/tests/Carbon/InstanceTest.php @@ -140,7 +140,7 @@ public function testInvalidCast() public function testChildCast() { - $class = \get_class(new class () extends Carbon { + $class = \get_class(new class() extends Carbon { public function foo() { return 42; @@ -158,7 +158,7 @@ public function foo() public function testSiblingCast() { - $class = \get_class(new class () extends DateTime { + $class = \get_class(new class() extends DateTime { public function foo() { return 42; diff --git a/tests/Carbon/LocalizationTest.php b/tests/Carbon/LocalizationTest.php index 1d5d859c9a..a475593ea6 100644 --- a/tests/Carbon/LocalizationTest.php +++ b/tests/Carbon/LocalizationTest.php @@ -701,7 +701,7 @@ public function testNotLocaleAwareException() $this->markTestSkipped('In Symfony < 5, NotLocaleAwareException will never been thrown.'); } - $translator = new class () implements TranslatorInterface { + $translator = new class() implements TranslatorInterface { public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) { return 'x'; diff --git a/tests/CarbonImmutable/InstanceTest.php b/tests/CarbonImmutable/InstanceTest.php index ad4eac95ca..937f6bd117 100644 --- a/tests/CarbonImmutable/InstanceTest.php +++ b/tests/CarbonImmutable/InstanceTest.php @@ -141,7 +141,7 @@ public function testInvalidCast() public function testChildCast() { - $class = \get_class(new class () extends Carbon { + $class = \get_class(new class() extends Carbon { public function foo() { return 42; @@ -159,7 +159,7 @@ public function foo() public function testSiblingCast() { - $class = \get_class(new class () extends DateTime { + $class = \get_class(new class() extends DateTime { public function foo() { return 42; diff --git a/tests/CarbonImmutable/LocalizationTest.php b/tests/CarbonImmutable/LocalizationTest.php index 88b7bccb13..0fe7bfecee 100644 --- a/tests/CarbonImmutable/LocalizationTest.php +++ b/tests/CarbonImmutable/LocalizationTest.php @@ -673,7 +673,7 @@ public function testNotLocaleAwareException() $this->markTestSkipped('In Symfony < 5, NotLocaleAwareException will never been thrown.'); } - $translator = new class () implements TranslatorInterface { + $translator = new class() implements TranslatorInterface { public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) { return 'x'; diff --git a/tests/CarbonImmutable/SetStateTest.php b/tests/CarbonImmutable/SetStateTest.php index 058767fc26..7343e4f7ec 100644 --- a/tests/CarbonImmutable/SetStateTest.php +++ b/tests/CarbonImmutable/SetStateTest.php @@ -21,7 +21,7 @@ class SetStateTest extends AbstractTestCase { public function testSteState() { - $obj = new class () { + $obj = new class() { use Serialization; public static function instance($value) diff --git a/tests/CarbonPeriod/CreateTest.php b/tests/CarbonPeriod/CreateTest.php index 49037433e9..47789c29a8 100644 --- a/tests/CarbonPeriod/CreateTest.php +++ b/tests/CarbonPeriod/CreateTest.php @@ -631,7 +631,7 @@ public function testInstance() public function testCast() { - $period = new class ('2012-07-01', CarbonInterval::days(2), '2012-07-07') extends CarbonPeriod { + $period = new class('2012-07-01', CarbonInterval::days(2), '2012-07-07') extends CarbonPeriod { public function foo() { return $this->getStartDate()->format('j').' '. diff --git a/tests/CarbonTimeZone/ConversionsTest.php b/tests/CarbonTimeZone/ConversionsTest.php index 6b54a3db6f..aa2a913a14 100644 --- a/tests/CarbonTimeZone/ConversionsTest.php +++ b/tests/CarbonTimeZone/ConversionsTest.php @@ -126,7 +126,7 @@ public function testCast() $this->assertSame(DateTimeZone::class, \get_class($tz)); $this->assertSame('America/Toronto', $tz->getName()); - $obj = new class () extends CarbonTimeZone { + $obj = new class() extends CarbonTimeZone { }; $class = \get_class($obj); diff --git a/tests/PHPStan/MacroTest.php b/tests/PHPStan/MacroTest.php index 8fa33382d6..3f859c00fe 100644 --- a/tests/PHPStan/MacroTest.php +++ b/tests/PHPStan/MacroTest.php @@ -63,7 +63,7 @@ public function testIsPublic() public function testIsFinal() { - $mixinClass = new class () { + $mixinClass = new class() { // Declaring final won't apply for macro, sub-class will always be able to override macros. final public static function foo(): string { @@ -232,7 +232,7 @@ public function testGetPrototype() public function testGetReflection() { - $mixinClass = new class () { + $mixinClass = new class() { // Declaring final won't apply for macro, sub-class will always be able to override macros. final public static function foo(): string {