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..ed1572c35cf --- /dev/null +++ b/rules-tests/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector/Fixture/skip_any_call_like_with_args.php.inc @@ -0,0 +1,16 @@ + $second; + } +} diff --git a/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php b/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php index 376c5965c83..229813b3cf8 100644 --- a/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php +++ b/rules/CodingStyle/Rector/ClassMethod/BinaryOpStandaloneAssignsToDirectRector.php @@ -7,8 +7,8 @@ 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; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\ClassMethod; @@ -133,7 +133,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->isFirstClassCallable() && $assign->expr->getArgs() !== []) { return null; }