From 8e6463b269d00d1a577b27593bc036393579d03f Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 11 Oct 2025 17:12:49 +0700 Subject: [PATCH 1/5] [CodingStyle] Skip any CallLike with args !== [] on BinaryOpStandaloneAssignsToDirectRector --- .../skip_any_call_like_with_args.php.inc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 rules-tests/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector/Fixture/skip_any_call_like_with_args.php.inc diff --git a/rules-tests/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector/Fixture/skip_any_call_like_with_args.php.inc b/rules-tests/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector/Fixture/skip_any_call_like_with_args.php.inc new file mode 100644 index 00000000000..5ccb6472b07 --- /dev/null +++ b/rules-tests/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector/Fixture/skip_any_call_like_with_args.php.inc @@ -0,0 +1,18 @@ + $second; + } +} + +?> \ No newline at end of file From 203b934a852eeeb26dfd960b217995b6a3bd4826 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 11 Oct 2025 17:13:56 +0700 Subject: [PATCH 2/5] fix --- .../ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php b/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php index 376c5965c83..06b32d6211a 100644 --- a/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php @@ -7,6 +7,7 @@ use PhpParser\Node; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\BinaryOp; +use PhpParser\Node\Expr\CallLike; use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\Variable; @@ -133,7 +134,7 @@ private function matchToVariableAssignExpr(Stmt $stmt): ?VariableAndExprAssign } // skip complex cases - if ($assign->expr instanceof MethodCall && $assign->expr->args !== []) { + if ($assign->expr instanceof CallLike && $assign->expr->args !== []) { return null; } From a081ee44f5933a9e0e13262525bdd2dffdb59c9a Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 11 Oct 2025 17:14:09 +0700 Subject: [PATCH 3/5] fix --- .../Fixture/skip_any_call_like_with_args.php.inc | 2 -- 1 file changed, 2 deletions(-) diff --git a/rules-tests/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector/Fixture/skip_any_call_like_with_args.php.inc b/rules-tests/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector/Fixture/skip_any_call_like_with_args.php.inc index 5ccb6472b07..ed1572c35cf 100644 --- a/rules-tests/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector/Fixture/skip_any_call_like_with_args.php.inc +++ b/rules-tests/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector/Fixture/skip_any_call_like_with_args.php.inc @@ -14,5 +14,3 @@ final class SkipAnyCallLikeWithArgs return $first <=> $second; } } - -?> \ No newline at end of file From a95b512767f82f3469f148b67a4238e150f16466 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sat, 11 Oct 2025 10:16:37 +0000 Subject: [PATCH 4/5] [ci-review] Rector Rectify --- .../ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php | 1 - 1 file changed, 1 deletion(-) diff --git a/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php b/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php index 06b32d6211a..68315a85495 100644 --- a/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php @@ -9,7 +9,6 @@ use PhpParser\Node\Expr\BinaryOp; use PhpParser\Node\Expr\CallLike; use PhpParser\Node\Expr\Closure; -use PhpParser\Node\Expr\MethodCall; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\ClassMethod; From dc6f6a2759e9216c1b4b92e88900b2d96e0d2c22 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 11 Oct 2025 17:17:03 +0700 Subject: [PATCH 5/5] fix --- .../ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php b/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php index 68315a85495..229813b3cf8 100644 --- a/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php @@ -133,7 +133,7 @@ private function matchToVariableAssignExpr(Stmt $stmt): ?VariableAndExprAssign } // skip complex cases - if ($assign->expr instanceof CallLike && $assign->expr->args !== []) { + if ($assign->expr instanceof CallLike && ! $assign->expr->isFirstClassCallable() && $assign->expr->getArgs() !== []) { return null; }