From 8ec89bac5d1897e8f7fda4c30c16863ac903f36a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Gon=C3=A7alves?= Date: Tue, 16 Sep 2025 17:48:09 +0100 Subject: [PATCH 1/2] Fix yoda style --- php-cs-fixer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/php-cs-fixer.php b/php-cs-fixer.php index 9a7035e..92b2f1d 100644 --- a/php-cs-fixer.php +++ b/php-cs-fixer.php @@ -72,9 +72,9 @@ 'void_return' => true, 'yoda_style' => [ 'always_move_variable' => false, - 'equal' => false, - 'identical' => false, - 'less_and_greater' => false, + 'equal' => null, + 'identical' => null, + 'less_and_greater' => null, ], ]) ->setFinder( From 424600c36cb58eb86f9e45a4dd3139193e50b0bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Gon=C3=A7alves?= Date: Tue, 16 Sep 2025 17:52:59 +0100 Subject: [PATCH 2/2] Fix tests --- .../Kununu/CsFixer/_data/fixer_test_cases.php | 121 ++++++++---------- 1 file changed, 50 insertions(+), 71 deletions(-) diff --git a/tests/Unit/Kununu/CsFixer/_data/fixer_test_cases.php b/tests/Unit/Kununu/CsFixer/_data/fixer_test_cases.php index 7da2f84..cbba18b 100644 --- a/tests/Unit/Kununu/CsFixer/_data/fixer_test_cases.php +++ b/tests/Unit/Kununu/CsFixer/_data/fixer_test_cases.php @@ -1,4 +1,6 @@ [ 'before' => <<<'PHP' @@ -12,8 +14,7 @@ public function foo() return 1; } } -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -37,8 +38,7 @@ public function foo() $a = 1; $b = 2; unset($a); unset($b); -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -57,8 +57,7 @@ public function foo() 'two' =>2, 'three'=> 3 ]; -PHP - , +PHP, 'after' => <<<'PHP' 3, ]; -PHP +PHP, ], 'explicit_indirect_variable' => [ @@ -76,29 +75,27 @@ public function foo() <<<'PHP' [ 'before' => <<<'PHP' <<<'PHP' [ @@ -107,8 +104,7 @@ public function foo() $doc = << <<<'PHP' [ @@ -132,8 +128,7 @@ public function now(): void echo $dt->format('Y'); } } -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -168,8 +163,7 @@ public function doStuff () return $fn(1); } } -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -212,8 +206,7 @@ private function isReady(): bool return static::$count > 0; } } -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -246,8 +239,7 @@ function maybe($x) { return isset($x) ? $x : null; } -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -267,8 +259,7 @@ function assignThenReturn() $a = 5; return $a; } -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -292,8 +283,7 @@ public function isNonZero(): bool return static::$count > 0; } } -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -320,8 +310,7 @@ public function doSomething() echo "hello"; } } -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -349,23 +338,22 @@ function check($a) return false; } } -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -386,8 +374,7 @@ public function test() return 1; } } -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -412,8 +399,7 @@ public function test() $result = strlen("abc"); $now = time(); -PHP - , +PHP, 'after' => <<<'PHP' [ 'before' => <<<'PHP' <<<'PHP' [ @@ -445,15 +430,14 @@ public function test() <<<'PHP' [ @@ -463,8 +447,7 @@ public function test() 'a', 'b' ]; -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -491,8 +474,7 @@ public function test(): void new Used(); } } -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -522,8 +504,7 @@ public function test(): void * @author Someone */ class Example {} -PHP - , +PHP, 'after' => <<<'PHP' [ @@ -544,8 +525,7 @@ class Example <<<'PHP' [ @@ -568,8 +548,7 @@ public function inc(): void static::$count++; } } -PHP - , +PHP, 'after' => <<<'PHP'